Search PostgreSQL documentation
PG 18 · Browse by category, or enter a name or keyword
Category index4025
Date/Time Output8.5.2. Date/Time Output
The output format of the date/time types can be set to one of the four styles ISO 8601, SQL (Ingres), traditional POSTGRES (Unix date format), or German. The default …Date/Time Output
Date/Time SupportAppendix B. Date/Time Support
PostgreSQL uses an internal heuristic parser for all date/time input support. Dates and times are input as strings, and are broken up into distinct fields with …Date/Time Support
Date/Time Types8.5. Date/Time Types
PostgreSQL supports the full set of SQL date and time types, shown in Table 8.9. The operations available on these data types are described in Section 9.9. Dates are cou…Date/Time Types
date_bin9.9.3. date_bin
The function date_bin “bins” the input timestamp into the specified interval (the stride) aligned with a specified origin.
date_bin(stride, source, origin)
source is a value …date_bin
date_trunc9.9.2. date_trunc
The function date_trunc is conceptually similar to the trunc function for numbers.
date_trunc(field, source [, time_zone ])
source is a value expression of type timestamp, …date_trunc
Dates8.5.1.1. Dates
Table 8.10 shows some possible inputs for the date type.
Table 8.10. Date Input Example Description 1999-01-08 ISO 8601; January 8 in any mode (recommended format) January 8, …Dates
dblinkdblink dblink — executes a query in a remote database
Synopsis dblink(text connname, text sql [, bool fail_on_error]) returns setof record dblink(text connstr, text sql [, bool fail_on_error…dblink
dblink — connect to other PostgreSQL databasesF.11. dblink — connect to other PostgreSQL databases
dblink is a module that supports connections to other PostgreSQL databases from within a database session.
dblink can report the followin…dblink — connect to other PostgreSQL databases
dblink_build_sql_deletedblink_build_sql_delete dblink_build_sql_delete — builds a DELETE statement using supplied values for primary key field values
Synopsis dblink_build_sql_delete(text relname, int2vector prima…dblink_build_sql_delete
dblink_build_sql_insertdblink_build_sql_insert dblink_build_sql_insert — builds an INSERT statement using a local tuple, replacing the primary key field values with alternative supplied values
Synopsis dblink_buil…dblink_build_sql_insert
dblink_build_sql_updatedblink_build_sql_update dblink_build_sql_update — builds an UPDATE statement using a local tuple, replacing the primary key field values with alternative supplied values
Synopsis dblink_buil…dblink_build_sql_update
dblink_cancel_querydblink_cancel_query dblink_cancel_query — cancels any active query on the named connection
Synopsis dblink_cancel_query(text connname) returns textdblink_cancel_query
dblink_closedblink_close dblink_close — closes a cursor in a remote database
Synopsis dblink_close(text cursorname [, bool fail_on_error]) returns text dblink_close(text connname, text cursorname [, boo…dblink_close
dblink_connectdblink_connect dblink_connect — opens a persistent connection to a remote database
Synopsis dblink_connect(text connstr) returns text dblink_connect(text connname, text connstr) returns textdblink_connect
dblink_connect_udblink_connect_u dblink_connect_u — opens a persistent connection to a remote database, insecurely
Synopsis dblink_connect_u(text connstr) returns text dblink_connect_u(text connname, text c…dblink_connect_u
dblink_disconnectdblink_disconnect dblink_disconnect — closes a persistent connection to a remote database
Synopsis dblink_disconnect() returns text dblink_disconnect(text connname) returns textdblink_disconnect
dblink_error_messagedblink_error_message dblink_error_message — gets last error message on the named connection
Synopsis dblink_error_message(text connname) returns textdblink_error_message
dblink_execdblink_exec dblink_exec — executes a command in a remote database
Synopsis dblink_exec(text connname, text sql [, bool fail_on_error]) returns text dblink_exec(text connstr, text sql [, bool…dblink_exec
dblink_fetchdblink_fetch dblink_fetch — returns rows from an open cursor in a remote database
Synopsis dblink_fetch(text cursorname, int howmany [, bool fail_on_error]) returns setof record dblink_fetch…dblink_fetch
dblink_get_connectionsdblink_get_connections dblink_get_connections — returns the names of all open named dblink connections
Synopsis dblink_get_connections() returns text[]dblink_get_connections
dblink_get_notifydblink_get_notify dblink_get_notify — retrieve async notifications on a connection
Synopsis dblink_get_notify() returns setof (notify_name text, be_pid int, extra text) dblink_get_notify(tex…dblink_get_notify
dblink_get_pkeydblink_get_pkey dblink_get_pkey — returns the positions and field names of a relation's primary key fields
Synopsis dblink_get_pkey(text relname) returns setof dblink_pkey_resultsdblink_get_pkey
dblink_get_resultdblink_get_result dblink_get_result — gets an async query result
Synopsis dblink_get_result(text connname [, bool fail_on_error]) returns setof recorddblink_get_result
dblink_is_busydblink_is_busy dblink_is_busy — checks if connection is busy with an async query
Synopsis dblink_is_busy(text connname) returns intdblink_is_busy
dblink_opendblink_open dblink_open — opens a cursor in a remote database
Synopsis dblink_open(text cursorname, text sql [, bool fail_on_error]) returns text dblink_open(text connname, text cursorname, …dblink_open
dblink_send_querydblink_send_query dblink_send_query — sends an async query to a remote database
Synopsis dblink_send_query(text connname, text sql) returns intdblink_send_query
DDL PermissionsF.40.5.3. DDL Permissions
SELinux defines several permissions to control common operations for each object type; such as creation, alter, drop and relabel of security label. In addition, sev…DDL Permissions
ddl_command_end38.1.3. ddl_command_end
The ddl_command_end event occurs just after the execution of the same set of commands as ddl_command_start. To obtain more details on the DDL operations that took pla…ddl_command_end
ddl_command_start38.1.2. ddl_command_start
The ddl_command_start event occurs just before the execution of a DDL command. DDL commands in this context are:
CREATE ALTER DROP COMMENT GRANT IMPORT FOREIGN SCHE…ddl_command_start
Deadlocks13.3.4. Deadlocks
The use of explicit locking can increase the likelihood of deadlocks, wherein two (or more) transactions each hold locks that the other wants. For example, if transaction 1…Deadlocks
DEALLOCATEDEALLOCATE DEALLOCATE — deallocate a prepared statement
Synopsis DEALLOCATE [ PREPARE ] { name | ALL }DEALLOCATE
DEALLOCATE DESCRIPTORDEALLOCATE DESCRIPTOR DEALLOCATE DESCRIPTOR — deallocate an SQL descriptor area
Synopsis DEALLOCATE DESCRIPTOR nameDEALLOCATE DESCRIPTOR
Debian PackagesJ.2.3. Debian Packages
There is a full set of packages of the documentation tools available for Debian GNU/Linux. To install, simply use:
apt-get install docbook-xml docbook-xsl libxml2-util…Debian Packages
Debugging and Developer Settings32.20.2. Debugging and Developer Settings
A "dangerous debugging mode" may be enabled by setting the environment variable PGOAUTHDEBUG=UNSAFE. This functionality is provided for ease of loca…Debugging and Developer Settings
Declaration of Array Types8.15.1. Declaration of Array Types
To illustrate the use of array types, we create this table:
CREATE TABLE sal_emp ( name text, pay_by_quarter integer[], schedule text[][] );
As shown, an a…Declaration of Array Types
Declaration of Composite Types8.16.1. Declaration of Composite Types
Here are two simple examples of defining composite types:
CREATE TYPE complex AS ( r double precision, i double precision ); CREATE TYPE inventory_item…Declaration of Composite Types
Declaration of Enumerated Types8.7.1. Declaration of Enumerated Types
Enum types are created using the CREATE TYPE command, for example:
CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy');
Once created, the enum type can be …Declaration of Enumerated Types
Declarations41.3. Declarations
All variables used in a block must be declared in the declarations section of the block. (The only exceptions are that the loop variable of a FOR loop iterating over a ran…Declarations
Declarative Partitioning5.12.2. Declarative Partitioning
PostgreSQL allows you to declare that a table is divided into partitions. The table that is divided is referred to as a partitioned table. The declaration in…Declarative Partitioning
DECLAREDECLARE DECLARE — define a cursor
Synopsis DECLARE cursor_name [ BINARY ] [ ASENSITIVE | INSENSITIVE ] [ [ NO ] SCROLL ] CURSOR [ { WITH | WITHOUT } HOLD ] FOR prepared_name DECLARE cursor_n…DECLARE
More results
Find definitions in the PostgreSQL manuals, reference library, and extension catalogue.
pg17: choose a version ex: extensions only ↑↓ select ↵ open