Geometric Type Conversion Functions
|
masklen(inet)
- integer
+ int
extract netmask length
masklen('192.168.1.5/24')
24
|
- set_masklen(inet, integer)
+ set_masklen(inet, int)
inet
set netmask length for inet value
set_masklen('192.168.1.5/24', 16)
|
family(inet)
- integer
+ int
extract family of address; 4 for IPv4,
6 for IPv6
family('::1')
the SQL standard, but are a common extension.
-
array_lower
- (anyarray, integer)
+ (anyarray, int)
- integer
+ int
returns lower bound of the requested array dimension
array_lower(array_prepend(0, ARRAY[1,2,3]), 1)
0
array_upper
- (anyarray, integer)
+ (anyarray, int)
- integer
+ int
returns upper bound of the requested array dimension
array_upper(ARRAY[1,2,3,4], 1)
4
avg(expression)
- smallint, integer,
+ smallint, int,
bigint, real, double
precision, numeric, or interval
bit_and(expression)
- smallint, integer, bigint, or
+ smallint, int, bigint, or
bit
bit_or(expression)
- smallint, integer, bigint, or
+ smallint, int, bigint, or
bit
stddev(expression)
- smallint, integer,
+ smallint, int,
bigint, real, double
precision, or numeric
|
sum(expression)
- smallint, integer,
+ smallint, int,
bigint, real, double
precision, numeric, or
interval
bigint for smallint or
- integer arguments, numeric for
+ int arguments, numeric for
bigint arguments, double precision
for floating-point arguments, otherwise the same as the
argument data type
variance(expression)
- smallint, integer,
+ smallint, int,
bigint, real, double
precision, or numeric
EXISTS
-EXISTS ( subquery )
+EXISTS (subquery)
otherwise the result of the row comparison is unknown (null).
+
+
+
row_constructor IS DISTINCT FROM row_constructor
functions
+
+
+
This section describes functions that possibly return more than one row.
Currently the only functions in this class are series generating functions,
|
inet_client_port()
- int4
+ int
port of the remote connection
|
inet_server_port()
- int4
+ int
port of the local connection
- pg_postmaster_start_time returns the timestamp with time zone
- when the postmaster> started.
+ pg_postmaster_start_time returns the
+ timestamp with time zone when the
+ postmaster> started.
|
pg_tablespace_databases(tablespace_oid)
setof oid
- get set of database OIDs that have objects in the tablespace
+ get the set of database OIDs that have objects in the tablespace
- pg_get_userbyid
- extracts a role's name given its OID.
- pg_get_serial_sequence
- fetches the name of the sequence associated with a serial or
- bigserial column. The name is suitably formatted
- for passing to the sequence functions (see
- linkend="functions-sequence">).
- NULL is returned if the column does not have a sequence attached.
+ pg_get_userbyid extracts a role's name given
+ its OID.
- pg_tablespace_databases allows usage examination of a
- tablespace. It will return a set of OIDs of databases that have objects
- stored in the tablespace. If this function returns any row, the
+ pg_get_serial_sequence fetches the name of the
+ sequence associated with a serial> or bigserial>
+ column. The name is suitably formatted for passing to the sequence
+ functions (see ). NULL is
+ returned if the column does not have an associated sequence.
+
+
+ pg_tablespace_databases allows a tablespace to
+ be examined. It returns the set of OIDs of databases that have objects
+ stored in the tablespace. If this function returns any rows, the
tablespace is not empty and cannot be dropped. To
display the specific objects populating the tablespace, you will need
to connect to the databases identified by
- pg_cancel_backend> sends a Query Cancel (SIGINT) signal
- to a backend process identified by process ID (pid).
- The process ID of an active backend can be found from the
- procpid column in the
+ pg_cancel_backend> sends a query cancel
+ (SIGINT>) signal to a backend process identified by
+ process ID. The process ID of an active backend can be found from
+ the procpid column in the
pg_stat_activity view, or by listing the
postgres processes on the server with
- pg_reload_conf> sends a SIGHUP signal to the
- postmaster, causing reload of the configuration files
- in all server processes.
+ pg_reload_conf> sends a SIGHUP> signal
+
to the postmaster>, causing the configuration files
+ to be reloaded by all server processes.
|
pg_column_size(any)
- integer
+ int
Number of bytes used to store a particular value (possibly compressed)
|
|
-
pg_read_file(filename> text>, offset> int8>, length> int8>)
+
pg_read_file(filename> text>, offset> bigint>, length> bigint>)
text
Return the contents of a text file
+
+ use in PL/PgSQL
+
+
+
+ use in PL/PgSQL
+
+
- This example shows use of the functions
- quote_ident(text) and
-
quote_literal(text).
quote_ident>use
- in
- PL/pgSQL>
quote_literal>use
- in PL/pgSQL> For safety, variables containing column and
- table identifiers should be passed to function
- quote_ident. Variables containing values
- that should be literal strings in the constructed command should
- be passed to quote_literal. Both take the
- appropriate steps to return the input text enclosed in double or
- single quotes respectively, with any embedded special characters
- properly escaped.
+ This example demonstrates the use of the
+ quote_ident and
+ quote_literal functions. For safety,
+ expressions containing column and table identifiers should be
+ passed to quote_ident. Expressions containing
+ values that should be literal strings in the constructed command
+ should be passed to quote_literal. Both
+ take the appropriate steps to return the input text enclosed in
+ double or single quotes respectively, with any embedded special
+ characters properly escaped.
EXECUTE works similarly to the
PL/SQL> version, but you have to remember to use
- quote_literal(text) and
-
quote_string(text) as described in
+ quote_literal and
+
quote_ident as described in
linkend="plpgsql-statements-executing-dyn">. Constructs of the
- type EXECUTE 'SELECT * FROM $1'; will not
- work unless you use these functions.
+ type EXECUTE 'SELECT * FROM $1'; will not work
+ unless you use these functions.
SETOF>function>> Alternatively,
an SQL function may be declared to return a set, by specifying the
function's return type as SETOF
- In this case all rows of the last query's result are returned.
- Further details appear below.
+ sometype>. In this case all rows of the
+ last query's result are returned. Further details appear below.