for SQL commands.
-<chapter Id="sql-commands">
-<title>Commandsitle>
+<Chapter>
+<Title>Commandsitle>
-<para>
-para>
+<Para>
+Para>
&alterTable;
&alterUser;
&createView;
&declare;
&delete;
+&dropAggregate;
+&dropDatabase;
&dropFunction;
+&dropIndex;
+&dropLanguage;
+&dropOperator;
+&dropRule;
+&dropSequence;
+&dropTable;
+&dropTrigger;
+&dropType
+&dropUser;
+&dropView;
&explain;
&fetch;
&grant;
&show;
&update;
-chapter>
+Chapter>
SQL Functions
+
--- /dev/null
+
+
+
+ DROP DATABASE
+
+ SQL - Language Statements
+
+
+
+ DROP DATABASE
+
+
+ Destroys an existing database
+
+
+
+ 1998-04-15
+
+
+ DROP DATABASE name
+
+
+
+
+ 1998-04-15
+
+
+ Inputs
+
+
+
+
+
+
+
+
+
+
+ name
+
+
+ The name of an existing database to remove.
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Outputs
+
+
+
+
+
+
+
+
+
+
+ DESTROYDB
+
+
+ This message is returned if the command is successful.
+
+
+
+
+
+ WARN: destroydb: database "name" does not exist.
+
+
+ This message occurs if the specified database does not exist.
+
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Description
+
+ DROP DATABASE removes the catalog entries for an existing
+ database and deletes the directory containing the data.
+ It can only be executed by the database administrator
+ (See the CREATE DATABASE command for details).
+
+
+
+
+ 1998-04-15
+
+
+ Notes
+
+
+ This query should NOT be executed interactively.
+ The destroydb script should be used instead.
+
+
+ Some explanation would be desirable here!
+
+ DROP DATABASE statement is a PostgreSQL language extension.
+
+ Refer to the CREATE DATABASE statement for
+ information on how to create a database.
+
+
+
+
+
+
+ Compatibility
+
+
+
+
+
+ 1998-04-15
+
+
+ SQL92
+
+ There is no DROP DATABASE statement in SQL92.
+
+
+
+
+
+
--- /dev/null
+
+
+
+ DROP INDEX
+
+ SQL - Language Statements
+
+
+
+ DROP INDEX
+
+
+ Removes an index from a database
+
+
+
+ 1998-04-15
+
+
+ DROP INDEX index_name
+
+
+
+
+ 1998-04-15
+
+
+ Inputs
+
+
+
+
+
+
+
+
+
+
+ index_name
+
+
+ The name of the index to remove.
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Outputs
+
+
+
+
+
+
+
+
+
+
+ DROP
+
+
+ The message returned if the index is successfully dropped.
+
+
+
+
+
+ ERROR: index "index_name" nonexistent
+
+
+ This message occurs if it is impossible to drop the index
+ because it does not exist.
+
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Description
+
+ DROP INDEX drops an existing index from the database
+ system. To execute this command you must be the owner of
+ the index.
+
+
+
+
+ 1998-04-15
+
+
+ Notes
+
+ DROP INDEX is a PostgreSQL language extension.
+
+ Refer to the CREATE INDEX statement for
+ inforamtion on how to create indexes.
+
+
+
+
+
+ Usage
+
+ This command will remove the title_idx index:
+
+ DROP INDEX title_idx;
+
+
+
+
+
+ Compatibility
+
+
+
+
+
+ 1998-04-15
+
+
+ SQL92
+
+ There is no DROP INDEX statement on SQL92.
+
+
+
+
+
+
+
--- /dev/null
+
+
+
+ DROP LANGUAGE
+
+ SQL - Language Statements
+
+
+
+ DROP LANGUAGE
+
+
+ Removes a user-defined procedural language
+
+
+
+ 1998-04-15
+
+
+ DROP PROCEDURAL LANGUAGE 'langname'
+
+
+
+
+ 1998-04-15
+
+
+ Inputs
+
+
+
+
+
+
+
+
+
+
+ langname
+
+
+ The name of an existing language.
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Outputs
+
+
+
+
+
+
+
+
+
+
+ DROP
+
+
+ This message is returned if the language is successfully dropped.
+
+
+
+
+
+
+ ERROR: Language "langname" doesn't exist
+
+
+ This message occurs if the language
+ "langname" is
+ not found.
+
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Description
+
+ DROP PROCEDURAL LANGUAGE will remove the definition
+ of the previously registered procedural language with the name
+ 'langname'.
+
+
+
+
+ 1998-04-15
+
+
+ Notes
+
+ The DROP PROCEDURAL LANGUAGE statement is
+ a PostgreSQL language extension.
+
+ Refer to the CREATE PROCEDURAL LANGUAGE statement
+ for information on how to create procedural languages.
+
+
+
+
+
+ 1998-04-15
+
+
+ Bugs
+
+ No checks are made if functions or trigger procedures registered
+ in this language still exist. To re-enable them without having
+ to drop and recreate all the functions, the pg_proc's prolang
+ attribute of the functions must be adjusted to the new object
+ ID of the recreated pg_language entry for the PL.
+
+
+
+
+
+
+ Usage
+
+ This command removes the PL/Sample language:
+
+ DROP PROCEDURAL LANGUAGE 'plsample'
+
+
+
+
+
+ Compatibility
+
+
+
+
+
+ 1998-04-15
+
+
+ SQL92
+
+ There is no DROP PROCEDURAL LANGUAGE statement on SQL92.
+
+
+
+
+
+
+
--- /dev/null
+
+
+
+ DROP OPERATOR
+
+ SQL - Language Statements
+
+
+
+ DROP OPERATOR
+
+
+ Removes an operator from the database
+
+
+
+
+
+ 1998-04-15
+
+
+ DROP OPERATOR id ( type | NONE [,...] );
+
+
+
+
+ 1998-04-15
+
+
+ Inputs
+
+
+
+
+
+
+
+
+
+
+ id
+
+
+ The identifier of an existing operator.
+
+
+
+
+
+ type
+
+
+ The type of function parameters.
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Outputs
+
+
+
+
+
+
+
+
+
+
+ DROP
+
+
+ The message returned if the command is successful.
+
+
+
+
+
+ ERROR: RemoveOperator: ... does not exist
+
+
+ This message occurs if the operator specified doesn't exist.
+
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Description
+
+ The DROP OPERATOR statement drops an existing operator from the
+ database.
+ To execute this command you must be the owner of the operator.
+
+ The left or right type of a left or right unary
+ operator, respectively, may be specified as NONE.
+
+
+
+
+ 1998-04-15
+
+
+ Notes
+
+ The DROP OPERATOR statement is a PostgreSQL
+ language extension.
+
+ Refer to the CREATE OPERATOR statement for
+ information on how to create operators.
+
+ It is the user's responsibility to remove any access methods,
+ operator classes, and so on, that rely on the deleted operator.
+
+
+
+
+
+ Usage
+
+ Remove power operator a^n for int4:
+
+ DROP OPERATOR ^ (int4, int4);
+
+ Remove left unary operator !a for booleans:
+
+ DROP OPERATOR ! (none, bool);
+
+ Remove right unary factorial operator a! for
+ int4:
+
+ DROP OPERATOR ! (int4, none);
+
+
+
+
+
+ Compatibility
+
+
+
+
+
+ 1998-04-15
+
+
+ SQL92
+
+ There is no DROP OPERATOR statement in SQL92.
+
+
+
+
+
+
--- /dev/null
+
+
+
+ DROP RULE
+
+ SQL - Language Statements
+
+
+
+ DROP RULE
+
+
+ Removes an existing rule from the database
+
+
+
+ 1998-04-15
+
+
+ DROP RULE name
+
+
+
+
+ 1998-04-15
+
+
+ Inputs
+
+
+
+
+
+
+
+
+
+
+ name
+
+
+ The name of an existing rule to drop.
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Outputs
+
+
+
+
+
+
+
+
+
+
+ DROP
+
+
+ Message returned if successfully.
+
+
+
+
+
+ ERROR: RewriteGetRuleEventRel: rule "name" not found
+
+
+ This message occurs if the specified rule does not exist.
+
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Description
+
+ DROP RULE drops a rule from the specified PostgreSQL rule
+ system. PostgreSQL will immediately cease enforcing it and
+ will purge its definition from the system catalogs.
+
+
+
+
+ 1998-04-15
+
+
+ Notes
+
+ The DROP RULE statement is a PostgreSQL
+ language extension.
+
+ Refer to the CREATE RULE statement for
+ information on how to create rules.
+
+
+
+
+
+ 1998-04-15
+
+
+ Bugs
+
+ Once a rule is dropped, access to historical information
+ the rule has written may disappear.
+
+
+
+
+
+
+ Usage
+
+ To drop the rewrite rule newrule:
+
+ DROP RULE newrule
+
+
+
+
+
+ Compatibility
+
+
+
+
+
+ 1998-04-15
+
+
+ SQL92
+
+ There is no DROP RULE statement in SQL92.
+
+
+
+
+
+
+
--- /dev/null
+
+
+
+ DROP SEQUENCE
+
+ SQL - Language Statements
+
+
+
+ DROP SEQUENCE
+
+
+ Removes an existing sequence
+
+
+
+ 1998-04-15
+
+
+ DROP SEQUENCE seqname [, ...]
+
+
+
+
+ 1998-04-15
+
+
+ Inputs
+
+
+
+
+
+
+
+
+
+
+ seqname
+
+
+ The name of a sequence.
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Outputs
+
+
+
+
+
+
+
+
+
+
+ DROP
+
+
+ The message returned if the sequence is successfully dropped.
+
+
+
+
+
+ WARN: Relation "seqname" does not exist.
+
+
+ This message occurs if the sequence specified does not exist.
+
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Description
+
+ DROP SEQUENCE removes sequence number generators from the
+ data base. With the current implementation of sequences as
+ special tables it works just like the DROP TABLE
+ statement.
+
+
+
+
+ 1998-04-15
+
+
+ Notes
+
+ The DROP SEQUENCE statement is a PostgreSQL
+ language extension.
+
+ Refer to the CREATE SEQUENCE statement for
+ information on how to create a sequence.
+
+
+
+
+
+ Usage
+
+ To remove sequence serial from database:
+
+ DROP SEQUENCE serial
+
+
+
+
+
+ Compatibility
+
+
+
+
+
+ 1998-04-15
+
+
+ SQL92
+
+ There is no DROP SEQUENCE statement in SQL92.
+
+
+
+
+
+
+
--- /dev/null
+
+
+
+ DROP TABLE
+
+ SQL - Language Statements
+
+
+
+ DROP TABLE
+
+
+ Removes existing tables from a database
+
+
+
+
+ 1998-04-15
+
+
+ DROP TABLE table [, ...]
+
+
+
+
+ 1998-04-15
+
+
+ Inputs
+
+
+
+
+
+
+
+
+
+
+ table
+
+
+ The name of an existing table or view to drop.
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Outputs
+
+
+
+
+
+
+
+
+
+
+ DROP
+
+
+ The message returned if the command completes successfully.
+
+
+
+
+
+ ERROR Relation "table" Does Not Exist!
+
+
+ If table/view specified doesn't exist into database.
+
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Description
+
+ DROP TABLE removes tables and views from the database.
+ Only its owner may destroy a table or view. A table
+ may be emptied of rows, but not destroyed, by using DELETE.
+
+ If a table being destroyed has secondary indices on it,
+ they will be removed first. The removal of just a
+ secondary index will not affect the indexed table.
+
+
+
+
+ 1998-04-15
+
+
+ Notes
+
+ Refer to the CREATE TABLE and
+ ALTER TABLE statements for information on
+ how to create or modify tables.
+
+
+
+
+
+
+ Usage
+
+ To destroy the films and
+ distributors tables:
+
+ DROP TABLE films, distributors
+
+
+
+
+
+ Compatibility
+
+
+
+
+
+ 1998-04-15
+
+
+ SQL92
+
+ SQL92 specifies some additional capabilities for DROP TABLE:
+
+
+ DROP TABLE table { RESTRICT | CASCADE }
+
+
+
+ RESTRICT
+
+ Ensures that only a table with no dependent views or
+ integrity constraints can be destroyed.
+
+
+
+
+ CASCADE
+
+ Any referencing views or integrity constraints
+ will also be dropped.
+
+
+
+
+
+ At present, to remove a referenced view you must drop
+ it by hand.
+
+
+
+
+
+
+
--- /dev/null
+
+
+
+ DROP TRIGGER
+
+ SQL - Language Statements
+
+
+
+ DROP TRIGGER
+
+
+ Removes the definition of a trigger
+
+
+
+ 1998-04-15
+
+
+ DROP TRIGGER name ON table
+
+
+
+
+ 1998-04-15
+
+
+ Inputs
+
+
+
+
+
+
+
+
+
+
+ name
+
+
+ The name of an existing trigger.
+
+
+
+
+
+ table
+
+
+ The name of a table.
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Outputs
+
+
+
+
+
+
+
+
+
+
+ DROP
+
+
+ The message returned if the trigger is successfully dropped.
+
+
+
+
+
+ ERROR: DropTrigger: there is no trigger name on relation "table"
+
+
+ This message occurs if the trigger specified does not exist.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Description
+
+ DROP TRIGGER will remove all references to an existing
+ trigger definition. To execute this command the current
+ user must be the owner of the trigger.
+
+
+
+
+ 1998-04-15
+
+
+ Notes
+
+ The DROP TRIGGER statement is a PostgreSQL
+ language extension.
+
+ Refer to the CREATE TRIGGER statement for
+ information on how to create triggers.
+
+
+
+
+
+ Usage
+
+ Destroy the if_dist_exists trigger on table films:
+
+ DROP TRIGGER if_dist_exists ON films;
+
+
+
+
+
+ Compatibility
+
+
+
+
+
+ 1998-04-15
+
+
+ SQL92
+
+ There is no DROP TRIGGER statement in SQL92.
+
+
+
+
+
+
+
+
--- /dev/null
+
+
+
+ DROP TYPE
+
+ SQL - Language Statements
+
+
+
+ DROP TYPE
+
+
+ Removes a user-defined type from the system catalogs
+
+
+
+ 1998-04-15
+
+
+ DROP TYPE typename
+
+
+
+
+ 1998-04-15
+
+
+ Inputs
+
+
+
+
+
+
+
+
+
+
+ typename
+
+
+ The name of an existing type.
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Outputs
+
+
+
+
+
+
+
+
+
+
+ DROP
+
+
+ The message returned if the command is successful.
+
+
+
+
+
+ ERROR: RemoveType: type 'typename' does not exist
+
+
+ This message occurs if the specified type is not found.
+
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Description
+
+ DROP TYPE will remove a user type from the
+ system catalogs.
+
+ Only the owner of a type can remove it.
+
+
+
+
+ 1998-04-15
+
+
+ Notes
+
+ DROP TYPE statement is a PostgreSQL language extension.
+
+ Refer to the CREATE TYPE statement for
+ inforamation on how to create types.
+
+ It is the user's responsibility to remove any operators,
+ functions, aggregates, access methods, subtypes, classes,
+ and so on, that use a deleted type.
+
+
+
+
+
+ 1998-04-15
+
+
+ Bugs
+
+ If a built-in type is removed, the behavior of the backend
+ is unpredictable.
+
+
+
+
+
+ Usage
+
+ To remove the box type:
+
+ DROP TYPE box
+
+
+
+
+
+ Compatibility
+
+
+
+
+
+ 1998-04-15
+
+
+ SQL3
+
+ DROP TYPE is a SQL3 statement.
+
+
+
+
+
+
+
--- /dev/null
+
+
+
+ DROP USER
+
+ SQL - Language Statements
+
+
+
+ DROP USER
+
+
+ Removes an user account information
+
+
+
+
+ 1998-04-15
+
+
+ DROP USER username
+
+
+
+
+ 1998-04-15
+
+
+ Inputs
+
+
+
+
+
+
+
+
+
+
+ username
+
+
+ The name of an existing user.
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Outputs
+
+
+
+
+
+
+
+
+
+
+ DROP
+
+
+ The message returned if the user is successfully deleted.
+
+
+
+
+
+ ERROR: removeUser: user "username" does not exist.
+
+
+ This message occurs if the username is not found.
+
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Description
+
+ The DROP USER statement removes the named
+ user from the database,
+ along with any databases owned by the user. It
+ does not remove tables, views, or triggers owned by the
+ named user in databases not owned by the user. This statement
+ can be used in the place of the destroyuser
+ script, regardless of how the user was created.
+
+
+
+
+ 1998-04-15
+
+
+ Notes
+
+ The DROP USER statement is a PostgreSQL
+ language extension.
+
+ Refer to the CREATE USER and
+ ALTER USER statements for information on
+ how to create or modify user accounts.
+
+
+
+
+
+ Usage
+
+ To drop a user account:
+
+ DROP USER Jonathan;
+
+
+
+
+
+ Compatibility
+
+
+
+
+
+ 1998-04-15
+
+
+ SQL92
+
+ There is no DROP USER statement on SQL92.
+
+
+
+
+
+
+
--- /dev/null
+
+
+
+ DROP VIEW
+
+ SQL - Language Statements
+
+
+
+ DROP VIEW
+
+
+ Removes an existing view from a database
+
+
+
+ 1998-04-15
+
+
+ DROP VIEW view
+
+
+
+
+ 1998-04-15
+
+
+ Inputs
+
+
+
+
+
+
+
+
+
+
+ view
+
+
+ The name of an existing view to drop.
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Outputs
+
+
+
+
+
+
+
+
+
+
+ DROP
+
+
+ The message returned if the command is successful.
+
+
+
+
+
+
+ ERROR: RewriteGetRuleEventRel: rule "_RETview" not found
+
+
+ This message occurs if the specified view does not exist in
+ the database.
+
+
+
+
+
+
+
+
+
+
+
+
+ 1998-04-15
+
+
+ Description
+
+ DROP VIEW drops an existing view from the database.
+ To execute this command you must be the owner of the
+ view.
+
+
+
+
+ 1998-04-15
+
+
+ Notes
+
+ The PostgreSQL DROP TABLE statement also drops views.
+
+ Refer to the CREATE VIEW statement for information on how to create views.
+
+
+
+
+
+ Usage
+
+ This command will remove the view called kinds:
+
+ DROP VIEW kinds
+
+
+
+
+
+ Compatibility
+
+
+
+
+
+ 1998-04-15
+
+
+ SQL92
+
+ SQL92 specifies some additional capabilities for
+ DROP VIEW:
+
+
+
+ DROP VIEW view {RESTRICT | CASCADE}
+
+
+
+ RESTRICT
+
+ Ensures that only a view with no dependent views or
+ integrity constraints can be destroyed.
+
+
+
+
+ CASCADE
+
+ Any referencing views and integrity constraints
+ will be dropped as well.
+
+
+
+
+
+ At present, to remove a referenced view from a PostgreSQL database,
+ you must drop it by hand.
+
+
+
+
+
+
+