Enhanced SQL and other miscellaneous features v15
EDB Postgres Advanced Server includes enhanced SQL functionality and other features that add flexibility and convenience.
COMMENT
In addition to allowing comments on objects supported by the PostgreSQL COMMENT
command, EDB Postgres Advanced Server supports comments on other object types. The complete supported syntax is:
Where aggregate_signature
is:
Parameters
object_name
The name of the object on which you're commenting.
AGGREGATE aggregate_name (aggregate_signature)
Include the AGGREGATE
clause to create a comment about an aggregate. aggregate_name
specifies the name of an aggregate. aggregate_signature
specifies the associated signature in one of the following forms:
Where argmode
is the mode of a function, procedure, or aggregate argument. argmode
can be IN
, OUT
, INOUT
, or VARIADIC
. The default is IN
.
argname
is the name of an aggregate argument.
argtype
is the data type of an aggregate argument.
CAST (source_type AS target_type)
Include the CAST
clause to create a comment about a cast. When creating a comment about a cast, source_type
specifies the source data type of the cast, and target_type
specifies the target data type of the cast.
COLUMN relation_name.column_name
Include the COLUMN
clause to create a comment about a column. column_name
specifies the name of the column to which the comment applies. relation_name
is the table, view, composite type, or foreign table in which a column resides.
CONSTRAINT constraint_name ON table_name
CONSTRAINT constraint_name ON DOMAIN domain_name
Include the CONSTRAINT
clause to add a comment about a constraint. When you're creating a comment about a constraint, constraint_name
specifies the name of the constraint. table_name
or domain_name
specifies the name of the table or domain on which the constraint is defined.
FUNCTION func_name ([[argmode] [argname] argtype [, ...]])
Include the FUNCTION
clause to add a comment about a function. func_name
specifies the name of the function. argmode
specifies the mode of the function. argmode
can be IN
, OUT
, INOUT
, or VARIADIC
. The default is IN
.
argname
specifies the name of a function, procedure, or aggregate argument. argtype
specifies the data type of a function, procedure, or aggregate argument.
large_object_oid
large_object_oid
is the system-assigned OID of the large object about which you're commenting.
OPERATOR operator_name (left_type, right_type)
Include the OPERATOR
clause to add a comment about an operator. operator_name
specifies the optionally schema-qualified name of an operator on which you're commenting. left_type
and right_type
are the optionally schema-qualified data types of the operator's arguments.
OPERATOR CLASS object_name USING index_method
Include the OPERATOR CLASS
clause to add a comment about an operator class. object_name
specifies the optionally schema-qualified name of an operator on which you're commenting. index_method
specifies the associated index method of the operator class.
OPERATOR FAMILY object_name USING index_method
Include the OPERATOR FAMILY
clause to add a comment about an operator family. object_name
specifies the optionally schema-qualified name of an operator family on which you're commenting. index_method
specifies the associated index method of the operator family.
POLICY policy_name ON table_name
Include the POLICY
clause to add a comment about a policy. policy_name
specifies the name of the policy. table_name
specifies the table that the policy is associated with.
PROCEDURE proc_name [([[argmode] [argname] argtype [, ...]])]
Include the PROCEDURE
clause to add a comment about a procedure. proc_name
specifies the name of the procedure. argmode
specifies the mode of the procedure. argmode
can be IN
, OUT
, INOUT
, or VARIADIC
. The default is IN
.
argname
specifies the name of a function, procedure, or aggregate argument. argtype
specifies the data type of a function, procedure, or aggregate argument.
RULE rule_name ON table_name
Include the RULE
clause to specify a comment on a rule. rule_name
specifies the name of the rule. table_name
specifies the name of the table on which the rule is defined.
TRANSFORM FOR type_name LANGUAGE lang_name
Include the TRANSFORM FOR
clause to specify a comment on a TRANSFORM
.
type_name
specifies the name of the data type of the transform. lang_name
specifies the name of the language of the transform.
TRIGGER trigger_name ON table_name
Include the TRIGGER
clause to specify a comment on a trigger. trigger_name
specifies the name of the trigger. table_name
specifies the name of the table on which the trigger is defined.
text
The comment, written as a string literal, or NULL
to drop the comment.
Note
Names of tables, aggregates, collations, conversions, domains, foreign tables, functions, indexes, operators, operator classes, operator families, packages, procedures, sequences, text search objects, types, and views can be schema qualified.
Example
This example adds a comment to a table named new_emp
:
For more information about using the COMMENT
command, see the PostgreSQL core documentation.
Output of function version()
The text string output of the version()
function displays the name of the product, its version, and the host system on which it was installed.
For EDB Postgres Advanced Server, the version()
output is in a format similar to the PostgreSQL community version. The first text word is PostgreSQL instead of EnterpriseDB as in EDB Postgres Advanced Server version 10 and earlier.
The general format of the version()
output is:
So for the current EDB Postgres Advanced Server, the version string appears as follows:
In contrast, for EDB Postgres Advanced Server 10, the version string was the following:
Logical decoding on standby
Logical decoding on a standby server allows you to create a logical replication slot on a standby server that can respond to API operations such as get
, peek
, and advance
.
For more information about logical decoding, refer to the PostgreSQL core documentation.
For a logical slot on a standby server to work, you must set the hot_standby_feedback
parameter to ON
on the standby. The hot_standby_feedback
parameter prevents VACCUM
from removing recently dead rows that are required by an existing logical replication slot on the standby server. If a slot conflict occurs on the standby, the slots are dropped.
For logical decoding on a standby to work, you must set wal_level
to logical
on both the primary and standby servers. If you set wal_level
to a value other than logical
, then slots aren't created. If you set wal_level
to a value other than logical
on primary, and if existing logical slots are on standby, such slots are dropped. You can't create new slots.
When transactions are written to the primary server, the activity triggers the creation of a logical slot on the standby server. If a primary server is idle, creating a logical slot on a standby server might take noticeable time.
For more information about functions that support replication, see the PostgreSQL documentation. See also this logical decoding example.