DO

NameDO -- execute an anonymous code block Synopsis DO [ LANGUAGE lang_name ] code Description DO executes an anonymous code block, or in other words a transient anonymous function in a procedural language. The code block is treated as though it were the body of a function with no parameters, returning void. It is parsed and executed a single time. The optional LANGUAGE clause can be written either before or after the code block. Parameters code The procedural language code to be

Catalogs: pg_pltemplate

The catalog pg_pltemplate stores "template" information for procedural languages. A template for a language allows the language to be created in a particular database by a simple CREATE LANGUAGE command, with no need to specify implementation details. Unlike most system catalogs, pg_pltemplate is shared across all databases of a cluster: there is only one copy of pg_pltemplate per cluster, not one per database. This allows the information to be accessible in each database as it is needed. Tab

Catalogs: pg_event_trigger

The catalog pg_event_trigger stores event triggers. See Chapter 38 for more information. Table 50-21. pg_event_trigger Columns Name Type References Description evtname name Trigger name (must be unique) evtevent name Identifies the event for which this trigger fires evtowner oid pg_authid.oid Owner of the event trigger evtfoid oid pg_proc.oid The function to be called evtenabled char Controls in which session_replication_role modes the event trigger fires. O = trigger fires in "origin"

Internals//BRIN Indexes: Built-in Operator Classes

The core PostgreSQL distribution includes the BRIN operator classes shown in Table 64-1. The minmax operator classes store the minimum and the maximum values appearing in the indexed column within the range. The inclusion operator classes store a value which includes the values in the indexed column within the range. Table 64-1. Built-in BRIN Operator Classes Name Indexed Data Type Indexable Operators abstime_minmax_ops abstime < <= = >= > int8_minmax_ops bigint < <= = &g

tsearch2

The tsearch2 module provides backwards-compatible text search functionality for applications that used tsearch2 before text searching was integrated into core PostgreSQL in release 8.3. F.41.1. Portability Issues Although the built-in text search features were based on tsearch2 and are largely similar to it, there are numerous small differences that will create portability issues for existing applications: Some functions' names were changed, for example rank to ts_rank. The replacement tsearc

ALTER RULE

NameALTER RULE -- change the definition of a rule Synopsis ALTER RULE name ON table_name RENAME TO new_name Description ALTER RULE changes properties of an existing rule. Currently, the only available action is to change the rule's name. To use ALTER RULE, you must own the table or view that the rule applies to. Parameters name The name of an existing rule to alter. table_name The name (optionally schema-qualified) of the table or view that the rule applies to. new_name The n

Catalogs: pg_db_role_setting

The catalog pg_db_role_setting records the default values that have been set for run-time configuration variables, for each role and database combination. Unlike most system catalogs, pg_db_role_setting is shared across all databases of a cluster: there is only one copy of pg_db_role_setting per cluster, not one per database. Table 50-16. pg_db_role_setting Columns Name Type References Description setdatabase oid pg_database.oid The OID of the database the setting is applicable to, or zero if

ABORT

NameABORT -- abort the current transaction Synopsis ABORT [ WORK | TRANSACTION ] Description ABORT rolls back the current transaction and causes all the updates made by the transaction to be discarded. This command is identical in behavior to the standard SQL command ROLLBACK, and is present only for historical reasons. Parameters WORKTRANSACTION Optional key words. They have no effect. Notes Use COMMIT to successfully terminate a transaction. Issuing ABORT outside of a tr

Performance Tips: Non-Durable Settings

Durability is a database feature that guarantees the recording of committed transactions even if the server crashes or loses power. However, durability adds significant database overhead, so if your site does not require such a guarantee, PostgreSQL can be configured to run much faster. The following are configuration changes you can make to improve performance in such cases. Except as noted below, durability is still guaranteed in case of a crash of the database software; only abrupt operating

LOCK

NameLOCK -- lock a table Synopsis LOCK [ TABLE ] [ ONLY ] name [ * ] [, ...] [ IN lockmode MODE ] [ NOWAIT ] where lockmode is one of: ACCESS SHARE | ROW SHARE | ROW EXCLUSIVE | SHARE UPDATE EXCLUSIVE | SHARE | SHARE ROW EXCLUSIVE | EXCLUSIVE | ACCESS EXCLUSIVE Description LOCK TABLE obtains a table-level lock, waiting if necessary for any conflicting locks to be released. If NOWAIT is specified, LOCK TABLE does not wait to acquire the desired lock: if it cannot be acquired