DROP TABLE

NameDROP TABLE -- remove a table Synopsis DROP TABLE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ] Description DROP TABLE removes tables from the database. Only the table owner, the schema owner, and superuser can drop a table. To empty a table of rows without destroying the table, use DELETE or TRUNCATE. DROP TABLE always removes any indexes, rules, triggers, and constraints that exist for the target table. However, to drop a table that is referenced by a view or a foreign-key co

DROP OWNED

NameDROP OWNED -- remove database objects owned by a database role Synopsis DROP OWNED BY { name | CURRENT_USER | SESSION_USER } [, ...] [ CASCADE | RESTRICT ] Description DROP OWNED drops all the objects within the current database that are owned by one of the specified roles. Any privileges granted to the given roles on objects in the current database and on shared objects (databases, tablespaces) will also be revoked. Parameters name The name of a role whose objects will be dr

DROP TYPE

NameDROP TYPE -- remove a data type Synopsis DROP TYPE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ] Description DROP TYPE removes a user-defined data type. Only the owner of a type can remove it. Parameters IF EXISTS Do not throw an error if the type does not exist. A notice is issued in this case. name The name (optionally schema-qualified) of the data type to remove. CASCADE Automatically drop objects that depend on the type (such as table columns, functions, and opera

DROP INDEX

NameDROP INDEX -- remove an index Synopsis DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ] Description DROP INDEX drops an existing index from the database system. To execute this command you must be the owner of the index. Parameters CONCURRENTLY Drop the index without locking out concurrent selects, inserts, updates, and deletes on the index's table. A normal DROP INDEX acquires exclusive lock on the table, blocking other accesses until the index d

DROP LANGUAGE

NameDROP LANGUAGE -- remove a procedural language Synopsis DROP [ PROCEDURAL ] LANGUAGE [ IF EXISTS ] name [ CASCADE | RESTRICT ] Description DROP LANGUAGE removes the definition of a previously registered procedural language. You must be a superuser or the owner of the language to use DROP LANGUAGE. Note: As of PostgreSQL 9.1, most procedural languages have been made into "extensions", and should therefore be removed with DROP EXTENSION not DROP LANGUAGE. Parameters IF EXISTS

Indexes and Collations

An index can support only one collation per index column. If multiple collations are of interest, multiple indexes may be needed. Consider these statements: CREATE TABLE test1c ( id integer, content varchar COLLATE "x" ); CREATE INDEX test1c_content_index ON test1c (content); The index automatically uses the collation of the underlying column. So a query of the form SELECT * FROM test1c WHERE content > constant; could use the index, because the comparison will by default use the

ALTER LANGUAGE

NameALTER LANGUAGE -- change the definition of a procedural language Synopsis ALTER [ PROCEDURAL ] LANGUAGE name RENAME TO new_name ALTER [ PROCEDURAL ] LANGUAGE name OWNER TO { new_owner | CURRENT_USER | SESSION_USER } Description ALTER LANGUAGE changes the definition of a procedural language. The only functionality is to rename the language or assign a new owner. You must be superuser or owner of the language to use ALTER LANGUAGE. Parameters name Name of a language new_name

Catalogs: pg_rewrite

The catalog pg_rewrite stores rewrite rules for tables and views. Table 50-41. pg_rewrite Columns Name Type References Description oid oid Row identifier (hidden attribute; must be explicitly selected) rulename name Rule name ev_class oid pg_class.oid The table this rule is for ev_type char Event type that the rule is for: 1 = SELECT, 2 = UPDATE, 3 = INSERT, 4 = DELETE ev_enabled char Controls in which session_replication_role modes the rule fires. O = rule fires in "origin" and "lo

Catalogs: pg_extension

The catalog pg_extension stores information about the installed extensions. See Section 36.15 for details about extensions. Table 50-22. pg_extension Columns Name Type References Description oid oid Row identifier (hidden attribute; must be explicitly selected) extname name Name of the extension extowner oid pg_authid.oid Owner of the extension extnamespace oid pg_namespace.oid Schema containing the extension's exported objects extrelocatable bool True if extension can be relocated to a

Catalogs: pg_indexes

The view pg_indexes provides access to useful information about each index in the database. Table 50-65. pg_indexes Columns Name Type References Description schemaname name pg_namespace.nspname Name of schema containing table and index tablename name pg_class.relname Name of table the index is for indexname name pg_class.relname Name of index tablespace name pg_tablespace.spcname Name of tablespace containing index (null if default for database) indexdef text Index definition (a reconstruct