ecpg

Name ecpg -- embedded SQL C preprocessor Synopsis ecpg [option...] file... Description ecpg is the embedded SQL preprocessor for C programs. It converts C programs with embedded SQL statements to normal C code by replacing the SQL invocations with special function calls. The output files can then be processed with any C compiler tool chain. ecpg will convert each input file given on the command line to the corresponding C output file. Input files preferably have the extension .pgc, in w

REINDEX

NameREINDEX -- rebuild indexes Synopsis REINDEX [ ( VERBOSE ) ] { INDEX | TABLE | SCHEMA | DATABASE | SYSTEM } name Description REINDEX rebuilds an index using the data stored in the index's table, replacing the old copy of the index. There are several scenarios in which to use REINDEX: An index has become corrupted, and no longer contains valid data. Although in theory this should never happen, in practice indexes can become corrupted due to software bugs or hardware failures. REIND

Catalogs: pg_authid

The catalog pg_authid contains information about database authorization identifiers (roles). A role subsumes the concepts of "users" and "groups". A user is essentially just a role with the rolcanlogin flag set. Any role (with or without rolcanlogin) can have other roles as members; see pg_auth_members. Since this catalog contains passwords, it must not be publicly readable. pg_roles is a publicly readable view on pg_authid that blanks out the password field. Chapter 21 contains detailed inform

Information Functions

Table 9-59 shows several functions that extract session and system information. In addition to the functions listed in this section, there are a number of functions related to the statistics system that also provide system information. See Section 28.2.2 for more information. Table 9-59. Session Information Functions Name Return Type Description current_catalog name name of current database (called "catalog" in the SQL standard) current_database() name name of current database current_query()

dropdb

Namedropdb -- remove a PostgreSQL database Synopsis dropdb [connection-option...] [option...] dbname Description dropdb destroys an existing PostgreSQL database. The user who executes this command must be a database superuser or the owner of the database. dropdb is a wrapper around the SQL command DROP DATABASE. There is no effective difference between dropping databases via this utility and via other methods for accessing the server. Options dropdb accepts the following command-line

Performance Tips: EXPLAIN

PostgreSQL devises a query plan for each query it receives. Choosing the right plan to match the query structure and the properties of the data is absolutely critical for good performance, so the system includes a complex planner that tries to choose good plans. You can use the EXPLAIN command to see what query plan the planner creates for any query. Plan-reading is an art that requires some experience to master, but this section attempts to cover the basics. Examples in this section are drawn

pg_basebackup

Namepg_basebackup -- take a base backup of a PostgreSQL cluster Synopsis pg_basebackup [option...] Description pg_basebackup is used to take base backups of a running PostgreSQL database cluster. These are taken without affecting other clients to the database, and can be used both for point-in-time recovery (see Section 25.3) and as the starting point for a log shipping or streaming replication standby servers (see Section 26.2). pg_basebackup makes a binary copy of the database cluster

Type Conversion

SQL is a strongly typed language. That is, every data item has an associated data type which determines its behavior and allowed usage. PostgreSQL has an extensible type system that is more general and flexible than other SQL implementations. Hence, most type conversion behavior in PostgreSQL is governed by general rules rather than by ad hoc heuristics. This allows the use of mixed-type expressions even with user-defined types. The PostgreSQL scanner/parser divides lexical elements into five f

Role Attributes

A database role can have a number of attributes that define its privileges and interact with the client authentication system. login privilege Only roles that have the LOGIN attribute can be used as the initial role name for a database connection. A role with the LOGIN attribute can be considered the same as a "database user". To create a role with login privilege, use either: CREATE ROLE name LOGIN; CREATE USER name; (CREATE USER is equivalent to CREATE ROLE except that CREATE USER assumes

droplang

Namedroplang -- remove a PostgreSQL procedural language Synopsis droplang [connection-option...] langname [dbname] droplang [connection-option...] --list | -l [dbname] Description droplang is a utility for removing an existing procedural language from a PostgreSQL database. droplang is just a wrapper around the DROP EXTENSION SQL command. Caution: droplang is deprecated and may be removed in a future PostgreSQL release. Direct use of the DROP EXTENSION command is recommended instead.