SELECT xmlelement(name foo, xmlattributes('xyz' as bar),
The xmlroot expression alters the properties
of the root node of an XML value. If a version is specified,
- this replaces the value in the version declaration; if a
- standalone value is specified, this replaces the value in the
- standalone declaration.
+ it replaces the value in the root node's version declaration; if a
+ standalone setting is specified, it replaces the value in the
+ root node's standalone declaration.
If a sequence object has been created with default parameters,
- nextval will return successive values
+ successive nextval calls will return successive values
beginning with 1. Other behaviors can be obtained by using
special parameters in the command;
see its command reference page for more information.
CASE clauses can be used wherever
- an expression is valid. condition is an
- expression that returns a boolean result. If the result is true
- the value of the CASE expression is the
- result that follows the condition. If the result is false
- subsequent WHEN clauses are searched in the same
- manner. If no WHEN
- condition is true then the value of the
- case expression is the result of the
+ an expression is valid. Each condition is an
+ expression that returns a boolean result. If the condition's
+ result is true, the value of the CASE expression is the
+ result that follows the condition, and the
+ remainder of the CASE expression is not processed. If the
+ condition's result is not true, any subsequent WHEN clauses
+ are examined in the same manner. If no WHEN
+ condition yields true, the value of the
+ CASE> expression is the result of the
ELSE clause. If the ELSE clause is
- omitted and no condition matches, the result is null.
+ omitted and no condition is true, the result is null.
- The following CASE expression is a
- variant of the general form above:
+ There is a simple> form of CASE expression
+ that is a variant of the general form above:
CASE expression
END
- The
- expression is computed and compared to
- all the values in the
- WHEN clauses until one is found that is equal. If
+ The first
+ expression is computed, then compared to
+ each of the value expressions in the
+ WHEN clauses until one is found that is equal to it. If
no match is found, the result of the
ELSE clause (or a null value) is returned. This is similar
to the switch statement in C.
- A CASE expression evaluates any subexpressions
- that are needed to determine the result. For example, this is a
+ A CASE expression does not evaluate any subexpressions
+ that are not needed to determine the result. For example, this is a
possible way of avoiding a division-by-zero failure:
SELECT ... WHERE CASE WHEN x <> 0 THEN y/x > 1.5 ELSE false END;
Like a CASE expression, COALESCE only
- evaluates arguments that are needed to determine the result;
+ evaluates the arguments that are needed to determine the result;
that is, arguments to the right of the first non-null argument are
not evaluated. This SQL-standard function provides capabilities similar
to NVL> and IFNULL>, which are used in some other
- Boolean aggregates bool_and and
+ Boolean aggregates bool_and and
bool_or correspond to standard SQL aggregates
every and any or
- some.
- As for any and some,
+ some.
+ As for any and some,
it seems that there is an ambiguity built into the standard syntax:
SELECT b1 = ANY((SELECT b2 FROM t2 ...)) FROM t1 ...;
- Here ANY can be considered as leading either
- to a subquery or to an aggregate, if the select expression returns one row.
+ Here ANY can be considered either as introducing
+ a subquery, or as being an aggregate function, if the sub-select
+ returns one row with a boolean value.
Thus the standard name cannot be given to these aggregates.
SELECT count(*) FROM sometable;
will be executed by
PostgreSQL using a
- sequential scan of an entire table.
+ sequential scan of the entire table.
or subquery. The
subquery is evaluated to determine whether it returns any rows.
If it returns at least one row, the result of EXISTS is
- true>; if the subquery returns no rows, the result of EXISTS
+ true>; if the subquery returns no rows, the result of EXISTS
is false>.
The forms involving array subexpressions are
PostgreSQL extensions; the rest are
- All of the expressions documented in this section return
+ All of the expression forms documented in this section return
Boolean (true/false) results.
pg_my_temp_schema returns the OID of the current
- session's temporary schema, or 0 if it has none (because no
- temporary tables have been created).
+ session's temporary schema, or zero if it has none (because it has not
+ created any temporary tables).
pg_is_other_temp_schema returns true if the
given OID is the OID of another session's temporary schema.
(This can be useful, for example, to exclude other sessions' temporary
has_any_column_privilege checks whether a user can
- access any column of a table in a particular way; its argument possibilities
+ access any column of a table in a particular way.
+ Its argument possibilities
are analogous to has_table_privilege>,
except that the desired access privilege type must evaluate to some
combination of
has_column_privilege checks whether a user
- can access a column in a particular way; its argument possibilities
+ can access a column in a particular way.
+ Its argument possibilities
are analogous to has_table_privilege,
with the addition that the column can be specified either by name
or attribute number.
has_database_privilege checks whether a user
- can access a database in a particular way; its argument possibilities
+ can access a database in a particular way.
+ Its argument possibilities
are analogous to has_table_privilege.
The desired access privilege type must evaluate to some combination of
CREATE,
has_function_privilege checks whether a user
- can access a function in a particular way; its argument possibilities
+ can access a function in a particular way.
+ Its argument possibilities
are analogous to has_table_privilege.
When specifying a function by a text string rather than by OID,
the allowed input is the same as for the regprocedure> data type
has_foreign_data_wrapper_privilege checks whether a user
- can access a foreign-data wrapper in a particular way; its argument possibilities
+ can access a foreign-data wrapper in a particular way.
+ Its argument possibilities
are analogous to has_table_privilege.
The desired access privilege type must evaluate to
USAGE.
has_language_privilege checks whether a user
- can access a procedural language in a particular way; its argument possibilities
+ can access a procedural language in a particular way.
+ Its argument possibilities
are analogous to has_table_privilege.
The desired access privilege type must evaluate to
USAGE.
has_schema_privilege checks whether a user
- can access a schema in a particular way; its argument possibilities
+ can access a schema in a particular way.
+ Its argument possibilities
are analogous to has_table_privilege.
The desired access privilege type must evaluate to some combination of
CREATE or
has_server_privilege checks whether a user
- can access a foreign server in a particular way; its argument possibilities
+ can access a foreign server in a particular way.
+ Its argument possibilities
are analogous to has_table_privilege.
The desired access privilege type must evaluate to
USAGE.
has_tablespace_privilege checks whether a user
- can access a tablespace in a particular way; its argument possibilities
+ can access a tablespace in a particular way.
+ Its argument possibilities
are analogous to has_table_privilege.
The desired access privilege type must evaluate to
CREATE.
pg_has_role checks whether a user
- can access a role in a particular way; its argument possibilities
+ can access a role in a particular way.
+ Its argument possibilities
are analogous to has_table_privilege.
The desired access privilege type must evaluate to some combination of
MEMBER or
get CREATE [ CONSTRAINT ] TRIGGER> command for trigger
|
-
pg_get_userbyid(roleid)
+
pg_get_userbyid(role_oid)
name
get role name with given OID
The functions shown in
- export server transaction information. The main
+ provide server transaction information in an exportable form. The main
use of these functions is to determine which transactions were committed
between two snapshots.
|
xmax
- First as-yet-unassigned txid. All txids later than this are
- not yet started as of the time of the snapshot, and thus invisible.
+ First as-yet-unassigned txid. All txids greater than or equal to this
+ are not yet started as of the time of the snapshot, and thus invisible.
Active txids at the time of the snapshot. The list
includes only those active txids between xmin>
and xmax>; there might be active txids higher
- than xmax. A txid that is xmin <= txid <
+ than xmax>. A txid that is xmin <= txid <
xmax and not in this list was already completed
at the time of the snapshot, and thus either visible or
dead according to its commit status. The list does not
The process ID of an active backend can be found from
the procpid column of the
pg_stat_activity view, or by listing the
- postgres processes on the server using
+ postgres processes on the server (using
pg_stop_backup()
text
- Finalize after performing on-line backup
+ Finish performing on-line backup
|
pg_current_xlog_location> displays the current transaction log write
- location in the format used by the above functions. Similarly,
+ location in the same format used by the above functions. Similarly,
pg_current_xlog_insert_location> displays the current transaction log
insertion point. The insertion point is the logical> end
of the transaction log
bigint
- Disk space used by the specified fork, 'main' or
- 'fsm', of a table or index with the specified OID
- or name; the table name can be schema-qualified.
+ Disk space used by the specified fork ('main',
+ 'fsm' or 'vm'>)
+ of the table or index with the specified OID or name
|
bigint
Total disk space used by the table with the specified OID or name,
- including indexes and
TOAST> data; the table name can be
- schema-qualified.
+ including indexes and
TOAST> data
size of the main data fork of the relation. Specifying
'fsm' returns the size of the
Free Space Map (see ) associated with the
+ relation. Specifying 'vm' returns the size of the
+ Visibility Map (see ) associated with the
relation.
size, last accessed time stamp, last modified time stamp,
last file status change time stamp (Unix platforms only),
file creation time stamp (Windows only), and a boolean
- indicating if it is a directory. Typical usage include:
+ indicating if it is a directory. Typical usages include:
SELECT * FROM pg_stat_file('filename');
SELECT (pg_stat_file('filename')).modification;
pg_advisory_unlock_shared> works the same as
- pg_advisory_unlock>,
- except is releases a shared advisory lock.
+ pg_advisory_unlock>,
+ except it releases a shared advisory lock.
pg_advisory_unlock_all> will release all advisory locks
held by the current session. (This function is implicitly invoked
- at session end, even if the client disconnects abruptly.)
+ at session end, even if the client disconnects ungracefully.)