diff --git a/doc/src/sgml/ref/abort.sgml b/doc/src/sgml/ref/abort.sgml index d849c7ccff..32fc9a27fd 100644 --- a/doc/src/sgml/ref/abort.sgml +++ b/doc/src/sgml/ref/abort.sgml @@ -1,135 +1,152 @@ - - - -ABORT - -SQL - Language Statements - - - -ABORT - - -Aborts the current transaction - - - - -1998-09-27 - - -ABORT - - - - -1998-09-27 - - -Inputs - - -None. - - - - - - -1998-09-27 - - -Outputs - - - - - - + + + ABORT - - - - Message returned if successful. - - - - - + + SQL - Language Statements + + + + ABORT + + + Aborts the current transaction + + + + + 1998-09-27 + + +ABORT [ TRANSACTION | WORK ] + + + + + 1998-09-27 + + + Inputs + + + + None. + + + + + + 1998-09-27 + + + Outputs + + + + + + + +ABORT + + + + Message returned if successful. + + + + + NOTICE: UserAbortTransactionBlock and not in in-progress state ABORT - - - - If there is not any transaction currently in progress. - - - - - - - + + + + If there is not any transaction currently in progress. + + + + + + + - - -1998-09-27 - - -Description - - + + + 1998-09-27 + + + 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 SQL92 command ROLLBACK, -and is present only for historical reasons. - - - -1998-09-27 - - -Notes - - -Use the COMMIT statement to successfully - terminate a transaction. - - - + This command is identical + in behavior to the SQL92 command ROLLBACK, + and is present only for historical reasons. + + + + 1998-09-27 + + + Notes + + + Use COMMIT to successfully + terminate a transaction. + + + - - -Usage - - - ---To abort all changes --- + + + Usage + + + To abort all changes: + ABORT WORK; - - + + - + - - -Compatibility - + + + Compatibility + - - -1998-09-27 - - -SQL92 - - -This command is a Postgres extension present -for historical reasons. ROLLBACK is the SQL92 -equivalent command. - - - + + + 1998-09-27 + + + SQL92 + + + This command is a Postgres extension present + for historical reasons. ROLLBACK is the SQL92 + equivalent command. + + + - + + + diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index c08245923b..25a2b948e4 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -1,153 +1,145 @@ - - - -ALTER TABLE - -SQL - Language Statements - - - -ALTER TABLE - - -Modifies table properties - - - - -1998-04-15 - - -ALTER TABLE table - [ * ] ADD [ COLUMN ] column type -ALTER TABLE table - [ * ] RENAME [ COLUMN ] column TO newcolumn -ALTER TABLE table - RENAME TO newtable - + + + + ALTER TABLE + + SQL - Language Statements + + + + ALTER TABLE + + + Modifies table properties + + + + + 1998-04-15 + + +ALTER TABLE table + [ * ] ADD [ COLUMN ] ER">coBLE> type +ALTER TABLE table + [ * ] RENAME [ COLUMN ] ER">coBLE> TO newcolumn +ALTER TABLE table + RENAME TO newtable + - - -1998-04-15 - - -Inputs - - - - - - table - - - - The name of an existing table to alter. - - - + + + 1998-04-15 + + + Inputs + + + + + table + + + The name of an existing table to alter. + + + - - - column - - - - Name of a new or existing column. - - - + + column + + + Name of a new or existing column. + + + - - - type - - - - Type of the new column. - - - + + type + + + Type of the new column. + + + - - - newcolumn - - - - New name for an existing column. - - - + + newcolumn + + + New name for an existing column. + + + - - - newtable - - - - New name for an existing column. - - - - - - + + newtable + + + New name for an existing column. + + + + + + - - -1998-04-15 - - -Outputs - - + + + 1998-04-15 + + + Outputs + + - - - -ALTER - - - - Message returned from column or table renaming. - - - + + + +ALTER + + + + Message returned from column or table renaming. + + + - - -NEW - - - - Message returned from column addition. - - - + + +NEW + + + + Message returned from column addition. + + + - - -ERROR - - - - Message returned if table or column is not available. - - - - - - - + + +ERROR + + + + Message returned if table or column is not available. + + + + + + + - - -1998-04-15 - - -Description - - + + + 1998-04-15 + + + Description + + ALTER TABLE changes the definition of an existing table. The new columns and their types are specified in the same style and with the the same restrictions as in CREATE TABLE. @@ -156,114 +148,117 @@ Description the affected table. Thus, the table or column will remain of the same type and size after this command is executed. - - + + + You must own the table in order to change its schema. - + - - -1998-04-15 - - -Notes - - -The keyword COLUMN is noise and can be omitted. - - -[*] following a name of a table indicates that statement - should be run over that table and all tables below it in the - inheritance hierarchy. + + + 1998-04-15 + + + Notes + + + The keyword COLUMN is noise and can be omitted. + + + + [*] following a name of a table indicates that statement + should be run over that table and all tables below it in the + inheritance hierarchy. The PostgreSQL User's Guide has further - information on inheritance. - + information on inheritance. + - - Refer to CREATE TABLE for a further description - of valid arguments. - - - + + Refer to CREATE TABLE for a further description + of valid arguments. + + + - - -Usage - - + + + Usage + + To add a column of type VARCHAR to a table: - - ALTER TABLE distributors ADD COLUMN address VARCHAR(30); - - + +ALTER TABLE distributors ADD COLUMN address VARCHAR(30); + + - + To rename an existing column: - - ALTER TABLE distributors RENAME COLUMN address TO city; - - + +ALTER TABLE distributors RENAME COLUMN address TO city; + + - + To rename an existing table: - - ALTER TABLE distributors RENAME TO suppliers; - - + +ALTER TABLE distributors RENAME TO suppliers; + + + - + + + Compatibility + - - -Compatibility - + + + 1998-04-15 + + + SQL92 + + + ALTER TABLE/RENAME + is a Postgres language extension. + - - -1998-04-15 - - -SQL92 - - -ALTER TABLE/RENAME - is a Postgres language extension. - + + SQL92 specifies some additional capabilities for ALTER TABLE + statement which are not yet directly supported by + Postgres: + - - SQL92 specifies some additional capabilities for ALTER TABLE - statement which are not yet directly supported by - Postgres: - + + + + +ALTER TABLE table ALTER [ + COLUMN ] column + SET DEFAULT default +ALTER TABLE table ALTER [ + COLUMN ] column + ADD [ CONSTRAINT >constrain> ] table-constraint + + + + + Puts the default value or constraint specified into the + definition of column in the table. + See CREATE TABLE for the + syntax of the default and table-constraint clauses. + If a default clause already exists, it will be replaced by + the new definition. If any constraints on this column already + exist, they will be retained using a boolean AND with the new + constraint. + - - - - -ALTER TABLE table ALTER [ COLUMN ] column - SET DEFAULT default + + Currently, to set new default constraints on an existing column + the table must be recreated and reloaded: -ALTER TABLE table ALTER [ COLUMN ] column - ADD [ CONSTRAINT constraint ] table-constraint - - - - - Puts the default value or constraint specified into the - definition of column in the table. - See CREATE TABLE for the - syntax of the default and table-constraint clauses. - If a default clause already exists, it will be replaced by - the new definition. If any constraints on this column already - exist, they will be retained using a boolean AND with the new - constraint. - - - -Currently, to set new default constraints on an existing column - the table must be recreated and reloaded: - - + CREATE TABLE temp AS SELECT * FROM distributors; DROP TABLE distributors; CREATE TABLE distributors ( @@ -273,65 +268,65 @@ CREATE TABLE distributors ( ); INSERT INTO distributors SELECT * FROM temp; DROP TABLE temp; - - - - + + + + - - - -ALTER TABLE table - DROP DEFAULT default -ALTER TABLE table - DROP CONSTRAINT constraint { RESTRICT | CASCADE } - - - - - Removes the default value specified by default or the rule - specified by constraint from the definition of a table. - If RESTRICT is specified only a constraint with no dependent - constraints can be destroyed. - If CASCADE is specified, Any constraints that are dependent on - this constraint are also dropped. - + + + +ALTER TABLE table + DROP DEFAULT default +ALTER TABLE table + DROP CONSTRAINT constraint { RESTRICT | CASCADE } + + + + + Removes the default value specified by default or the rule + specified by constraint from the definition of a table. + If RESTRICT is specified only a constraint with no dependent + constraints can be destroyed. + If CASCADE is specified, Any constraints that are dependent on + this constraint are also dropped. + - -Currently, to remove a default value or constraints on an - existing column the table must be recreated and reloaded: + + Currently, to remove a default value or constraints on an + existing column the table must be recreated and reloaded: - + CREATE TABLE temp AS SELECT * FROM distributors; DROP TABLE distributors; CREATE TABLE distributors AS SELECT * FROM temp; DROP TABLE temp; - - - - - - - - -ALTER TABLE table - DROP [ COLUMN ] column { RESTRICT | CASCADE } - - - - - Removes a column from a table. - If RESTRICT is specified only a column with no dependent - objects can be destroyed. - If CASCADE is specified, all objects that are dependent on - this column are also dropped. - + + + + - -Currently, to remove an existing column the table must be - recreated and reloaded: + + + +ALTER TABLE table + DROP [ COLUMN ] column { RESTRICT | CASCADE } + + + + + Removes a column from a table. + If RESTRICT is specified only a column with no dependent + objects can be destroyed. + If CASCADE is specified, all objects that are dependent on + this column are also dropped. + - + + Currently, to remove an existing column the table must be + recreated and reloaded: + + CREATE TABLE temp AS SELECT did, city FROM distributors; DROP TABLE distributors; CREATE TABLE distributors ( @@ -340,11 +335,28 @@ CREATE TABLE distributors ( ); INSERT INTO distributors SELECT * FROM temp; DROP TABLE temp; - - - - - - - - + + + + + + + + + + diff --git a/doc/src/sgml/ref/alter_user.sgml b/doc/src/sgml/ref/alter_user.sgml index 12426681a7..b7dc46e4b1 100644 --- a/doc/src/sgml/ref/alter_user.sgml +++ b/doc/src/sgml/ref/alter_user.sgml @@ -1,103 +1,97 @@ - - - - ALTER USER - - SQL - Language Statements - - - - ALTER USER - - - Modifies user account information - + + + + ALTER USER + + SQL - Language Statements + + + + ALTER USER + + + Modifies user account information + - - - 1998-09-08 - - -ALTER USER username - [ WITH PASSWORD password ] - [ CREATEDB | NOCREATEDB ] - [ CREATEUSER | NOCREATEUSER ] + + + 1998-09-08 + + +ALTER USER username [ WITH PASSWORD password ] + [ CREATEDB | NOCREATEDB ] [ CREATEUSER | NOCREATEUSER ] [ IN GROUP groupname [, ...] ] [ VALID UNTIL 'abstime' ] - - - - - 1998-09-08 - - - Inputs - - - Refer to CREATE USER for a detailed description of each - clause. - - - - - username - - - - The Postgres account name of the user whose details are to be altered. - - - + - - - password - - - - The new password to be used for this account. - - - + + + 1998-09-08 + + + Inputs + - - - groupname - - - - The name of an access group into which this account is to be put. - - - + + Refer to CREATE USER for a detailed description of each + clause. + - - - abstime - - - - The date (and, optionally, the time) - at which this user's access is to be terminated. - - - - - - - - - 1998-09-08 - - - Outputs - - - ALTER USER - + username + + + The Postgres account name of the user whose details are to be altered. + + + + + + password + + + The new password to be used for this account. + + + + + + groupname + + + The name of an access group into which this account is to be put. + + + + + + abstime + + + The date (and, optionally, the time) + at which this user's access is to be terminated. + + + + + + + + + + 1998-09-08 + + + Outputs + + + + + +ALTER USER + Message returned if the alteration was successful. @@ -106,13 +100,13 @@ ALTER USER username - - ERROR: alterUser: user "username" does not exist - + +ERROR: alterUser: user "username" does not exist + - Error message returned if the user specified doesn't - exist. + Error message returned if the specified user is not known to + the database. @@ -120,116 +114,116 @@ ALTER USER username - - - - 1998-09-08 - - - Description - - - ALTER USER is used to change the attributes of a user's - Postgres account. - Please note that it is not possible - to alter a user's "usesysid" via the alter user - statement. Also, it is only possible for the - Postgres - user or any user with read and modify permissions on - "pg_shadow" to alter user passwords. - - - If any of the clauses of the alter user statement are - omitted, the corresponding value in the "pg_shadow" table - is left unchanged. - + + + + 1998-09-08 + + + Description + + + ALTER USER is used to change the attributes of a user's + Postgres account. + Please note that it is not possible + to alter a user's "usesysid" via the alter user + statement. Also, it is only possible for the + Postgres + user or any user with read and modify permissions on + pg_shadow to alter user passwords. + + + + If any of the clauses of the alter user statement are + omitted, the corresponding value in the "pg_shadow" table + is left unchanged. + - - - 1998-09-08 - - - Notes - - - ALTER USER statement - is a Postgres - language extension. - - - Refer to CREATE/DROP USER - to create or remove a user - account. - - - In the current release (v6.5), the IN GROUP clause is parsed - but has no affect. When it is fully implemented, it is - intended to modify the pg_group relation. - - - - - - - Usage - - - Change a user password - - + + + 1998-09-08 + + + Notes + + + ALTER USER + is a Postgres + language extension. + + + Refer to CREATE/DROP USER + to create or remove a user account. + + + In the current release (v6.5), the IN GROUP clause is parsed + but has no affect. When it is fully implemented, it is + intended to modify the pg_group relation. + + + + + + + Usage + + + Change a user password: + + ALTER USER davide WITH PASSWORD hu8jmn3; - - - Change a user's valid until date - - + + + Change a user's valid until date + + ALTER USER manuel VALID UNTIL 'Jan 31 2030'; - - - Change a user's valid until date, specifying that his -authorisation should expire at midday on 4th May 1998 using -the time zone which is one hour ahead of UTC - - + + + Change a user's valid until date, specifying that his + authorisation should expire at midday on 4th May 1998 using + the time zone which is one hour ahead of UTC + ALTER USER chris VALID UNTIL 'May 4 12:00:00 1998 +1'; - - - Give a user the ability to create other users and new databases. - - + + + Give a user the ability to create other users and new databases. + + ALTER USER miriam CREATEUSER CREATEDB; - - - Place a user in two groups - - + + + Place a user in two groups + + ALTER USER miriam IN GROUP sales, payroll; - - - - - - Compatibility - - - + + + + + + + Compatibility + + + - - - 1998-09-08 - - - SQL92 - - - There is no ALTER USER statement in - SQL92. - The standard leaves - the definition of users to the implementation. - - - - + + + 1998-09-08 + + + SQL92 + + + There is no ALTER USER statement in + SQL92. + The standard leaves + the definition of users to the implementation. + + + + next-internal-state1 - sfunc2( internal-state2 ) ---> next-internal-state2 +sfunc1( internal-state1, next-data_item ) ---> next-internal-state1 sfunc2( internal-state2 ) ---> next-internal-state2 and a final calculation function, - ffunc: + ffunc: - ffunc(internal-state1, internal-state2) ---> aggregate-value +ffunc(internal-state1, internal-state2) ---> aggregate-value Postgres creates up to two temporary variables - (referred to here as temp1 - and temp2) + (referred to here as temp1 + and temp2) to hold intermediate results used as arguments to the transition functions. @@ -225,42 +206,42 @@ The initial value for the second transition function argument. The arguments to - sfunc1 + sfunc1 must be - temp1 + temp1 of type - sfunc1_return_type + sfunc1_return_type and - column_value - of type data_type. + column_value + of type data_type. The return value must be of type - sfunc1_return_type + sfunc1_return_type and will be used as the first argument in the next call to - sfunc1. + sfunc1. The argument and return value of - sfunc2 + sfunc2 must be - temp2 + temp2 of type - sfunc2_return_type. + sfunc2_return_type. The arguments to the final-calculation-function must be - temp1 + temp1 and - temp2 + temp2 and its return value must be a Postgres base type (not necessarily - data_type + data_type which had been specified for BASETYPE). @@ -269,10 +250,9 @@ The initial value for the second transition function argument. FINALFUNC should be specified if and only if both state-transition functions are specified. - + - + An aggregate function may also require one or two initial conditions, @@ -281,72 +261,72 @@ The initial value for the second transition function argument. in the database as fields of type text. - - - 1998-09-09 - - + <refsect2 id="R2-SQL-CREATEAGGREGATE-3"> + <refsect2info> + <date>1998-09-09</date> + </refsect2info> + <title> Notes - + Use DROP AGGREGATE - to drop aggregate functions. + to drop aggregate functions. - - It is possible to specify aggregate functions - that have varying combinations of state and final functions. - For example, the count aggregate requires SFUNC2 - (an incrementing function) but not SFUNC1 or FINALFUNC, - whereas the sum aggregate requires SFUNC1 (an addition - function) but not SFUNC2 or FINALFUNC and the avg - aggregate requires - both of the above state functions as - well as a FINALFUNC (a division function) to produce its - answer. In any case, at least one state function must be - defined, and any SFUNC2 must have a corresponding INITCOND2. + + It is possible to specify aggregate functions + that have varying combinations of state and final functions. + For example, the count aggregate requires SFUNC2 + (an incrementing function) but not SFUNC1 or FINALFUNC, + whereas the sum aggregate requires SFUNC1 (an addition + function) but not SFUNC2 or FINALFUNC and the avg + aggregate requires + both of the above state functions as + well as a FINALFUNC (a division function) to produce its + answer. In any case, at least one state function must be + defined, and any SFUNC2 must have a corresponding INITCOND2. - - + + - - + <refsect1 id="R1-SQL-CREATEAGGREGATE-2"> + <title> Usage - - + + Refer to the chapter on aggregate functions in the PostgreSQL Programmer's Guide on aggregate functions for complete examples of usage. - - - - + </refsect1> + + <refsect1 id="R1-SQL-CREATEAGGREGATE-3"> + <title> Compatibility - - - - - 1998-09-09 - - + + + + + 1998-09-09 + + SQL92 - - + + CREATE AGGREGATE is a Postgres language extension. There is no CREATE AGGREGATE in SQL92. - + - + - - + <refsect1 id="R1-SQL-CREATEDATABASE-4"> + <title> Compatibility - - - - - 1998-04-15 - - + + + + + 1998-04-15 + + SQL92 - - + + There is no CREATE DATABASE statement in SQL92. - + The equivalent command in standard SQL is CREATE SCHEMA. - - + - + - - + <refsect1 id="R1-SQL-CREATEINDEX-3"> + <title> Compatibility - - - + + + - - - 1998-09-09 - - + <refsect2 id="R2-SQL-CREATEINDEX-4"> + <refsect2info> + <date>1998-09-09</date> + </refsect2info> + <title> SQL92 - - + + CREATE INDEX is a Postgres language extension. - + There is no CREATE INDEX command in SQL92. - - + - + 1998-09-11 @@ -1562,7 +1497,7 @@ the column. Not our problem... constraint: - CREATE ASSERTION name CHECK ( condition ) +CREATE ASSERTION name CHECK ( condition ) @@ -1571,37 +1506,34 @@ the column. Not our problem... Domain constraint: + + +[ CONSTRAINT name ] CHECK constraint + [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] + [ [ NOT ] DEFERRABLE ] + - - [ CONSTRAINT name ] - CHECK constraint - [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] - [ [ NOT ] DEFERRABLE ] - + Table constraint definition: + + +[ CONSTRAINT name ] { PRIMARY KEY ( column, ... ) | FOREIGN KEY constraint | UNIQUE constraint | CHECK constraint } + [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] + [ [ NOT ] DEFERRABLE ] + - - [ CONSTRAINT name ] - { PRIMARY KEY constraint | - FOREIGN KEY constraint | - UNIQUE constraint | - CHECK constraint } - [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] - [ [ NOT ] DEFERRABLE ] + Column constraint definition: + + +[ CONSTRAINT name ] { NOT NULL | PRIMARY KEY | FOREIGN KEY constraint | UNIQUE | CHECK constraint } + [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] + [ [ NOT ] DEFERRABLE ] + - - [ CONSTRAINT name ] - { NOT NULL constraint | - PRIMARY KEY constraint | - FOREIGN KEY constraint | - UNIQUE constraint | - CHECK constraint } - [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] - [ [ NOT ] DEFERRABLE ] - + A CONSTRAINT definition may contain one deferment attribute clause and/or one initial constraint mode clause, in any order. @@ -1679,24 +1611,23 @@ affect a column or a table. --> table constraint definition: - - - [ CONSTRAINT name ] - CHECK ( VALUE condition ) + +[ CONSTRAINT name ] CHECK ( VALUE condition ) [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] [ [ NOT ] DEFERRABLE ] - + + + column constraint definition: - - [ CONSTRAINT name ] - CHECK ( VALUE condition ) +[ CONSTRAINT name ] CHECK ( VALUE condition ) [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] [ [ NOT ] DEFERRABLE ] + - - + 1998-09-11 @@ -1732,22 +1662,20 @@ affect a column or a table. Table Constraint definition: + +[ CONSTRAINT name ] PRIMARY KEY ( column [, ...] ) + [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] + [ [ NOT ] DEFERRABLE ] + - - [ CONSTRAINT name ] - PRIMARY KEY ( column [, ...] ) - [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] - [ [ NOT ] DEFERRABLE ] - Column Constraint definition: + +[ CONSTRAINT name ] PRIMARY KEY + [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] + [ [ NOT ] DEFERRABLE ] + - - [ CONSTRAINT name ] - PRIMARY KEY - [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] - [ [ NOT ] DEFERRABLE ] - diff --git a/doc/src/sgml/ref/create_table_as.sgml b/doc/src/sgml/ref/create_table_as.sgml index 01649be762..27ce6df645 100644 --- a/doc/src/sgml/ref/create_table_as.sgml +++ b/doc/src/sgml/ref/create_table_as.sgml @@ -33,9 +33,7 @@ CREATE TABLE table [ (column - - table - + table The name of a new table to be created. @@ -44,25 +42,21 @@ CREATE TABLE table [ (column - - column - - - - The name of a column. Multiple column names can be specified using -a comma-delimited list of column names. - - - - - - - select_clause - - - -A valid query statement. Refer to SELECT for a description of the -allowed syntax. + column + + + The name of a column. Multiple column names can be specified using + a comma-delimited list of column names. + + + + + + select_clause + + + A valid query statement. Refer to SELECT for a description of the + allowed syntax. @@ -78,7 +72,8 @@ allowed syntax. Outputs - Refer to CREATE TABLE and SELECT for a summary of possible output + Refer to CREATE TABLE + and SELECT for a summary of possible output messages. @@ -91,10 +86,10 @@ allowed syntax. Description - -CREATE TABLE AS enables a table to be created from the contents of -an existing table. It has functionality equivalent to SELECT TABLE INTO, -but with perhaps a more obvious syntax. + + CREATE TABLE AS enables a table to be created from the contents of + an existing table. It has functionality equivalent to SELECT TABLE INTO, + but with perhaps a more direct syntax. diff --git a/doc/src/sgml/ref/create_trigger.sgml b/doc/src/sgml/ref/create_trigger.sgml index c9e241b6f9..32952a29ce 100644 --- a/doc/src/sgml/ref/create_trigger.sgml +++ b/doc/src/sgml/ref/create_trigger.sgml @@ -1,120 +1,113 @@ - - - + + + CREATE TRIGGER - - SQL - Language Statements - - - + + SQL - Language Statements + + + CREATE TRIGGER - - + + Creates a new trigger - + - - - 1998-09-21 - - -CREATE TRIGGER name { BEFORE | AFTER } - { event [OR ...] } - ON table FOR EACH { ROW | STATEMENT } - EXECUTE PROCEDURE funcname ( arguments ) - + + + 1998-09-21 + + +CREATE TRIGGER name { BEFORE | AFTER } { event [OR ...] } + ON table FOR EACH { ROW | STATEMENT } + EXECUTE PROCEDURE ER">funcBLE> ( arguments ) + - - - 1998-09-21 - - + <refsect2 id="R2-SQL-CREATETRIGGER-1"> + <refsect2info> + <date>1998-09-21</date> + </refsect2info> + <title> Inputs - - - - - - - name - - - - The name of an existing trigger. - - - - - - table - - - - The name of a table. - - - - - - event - - - - One of INSERT, DELETE or UPDATE. - - - - - - funcname - - - - A user-supplied function. - - - - - - - - - 1998-09-21 - - - Outputs - - - - - - CREATE - - - - This message is returned if the trigger is successfully created. + + + + + + name + + + The name of an existing trigger. - + + table + + + The name of a table. + + + + + event + + + One of INSERT, DELETE or UPDATE. + + + + + funcname + + + A user-supplied function. + + + + - - + + + + + 1998-09-21 + + + Outputs + + + + + + +CREATE + + + + This message is returned if the trigger is successfully created. + + + + + + + - - - 1998-09-21 - - + <refsect1 id="R1-SQL-CREATETRIGGER-1"> + <refsect1info> + <date>1998-09-21</date> + </refsect1info> + <title> Description - - + + CREATE TRIGGER will enter a new trigger into the current data base. The trigger will be associated with the relation relname and will execute the specified function funcname. - - + + The trigger can be specified to fire either before the operation is attempted on a tuple (before constraints are checked and the INSERT, UPDATE or DELETE is attempted) or @@ -125,102 +118,106 @@ CREATE TRIGGER name { BEFORE | AFTE being inserted (for INSERT and UPDATE operations only). If the trigger fires after the event, all changes, including the last insertion, update, or deletion, are "visible" to the trigger. - - + + Refer to the chapters on SPI and Triggers in the PostgreSQL Programmer's Guide for more information. - - - - 1998-09-21 - - + </para> + <refsect2 id="R2-SQL-CREATETRIGGER-3"> + <refsect2info> + <date>1998-09-21</date> + </refsect2info> + <title> Notes - - + + CREATE TRIGGER is a Postgres language extension. - - - Only the relation owner may create a trigger on this relation. - - - As of the current release (v6.4), STATEMENT triggers are not implemented. - - + + + Only the relation owner may create a trigger on this relation. + + + As of the current release (v6.4), STATEMENT triggers are not implemented. + + Refer to DROP TRIGGER for information on how to remove triggers. - - + + - - + <refsect1 id="R1-SQL-CREATETRIGGER-2"> + <title> Usage - - + + Check if the specified distributor code exists in the distributors table before appending or updating a row in the table films: - - - CREATE TRIGGER if_dist_exists - BEFORE INSERT OR UPDATE ON films FOR EACH ROW - EXECUTE PROCEDURE check_primary_key ('did', 'distributors', 'did'); - - + + +CREATE TRIGGER if_dist_exists + BEFORE INSERT OR UPDATE ON films FOR EACH ROW + EXECUTE PROCEDURE check_primary_key ('did', 'distributors', 'did'); + + + Before cancelling a distributor or updating its code, remove every reference to the table films: - - - CREATE TRIGGER if_film_exists - BEFORE DELETE OR UPDATE ON distributors FOR EACH ROW - EXECUTE PROCEDURE check_foreign_key (1, 'CASCADE', 'did', 'films', 'did'); - - - - - + <programlisting> +CREATE TRIGGER if_film_exists + BEFORE DELETE OR UPDATE ON distributors FOR EACH ROW + EXECUTE PROCEDURE check_foreign_key (1, 'CASCADE', 'did', 'films', 'did'); + </programlisting> + </para> + </refsect1> + + <refsect1 id="R1-SQL-CREATETRIGGER-3"> + <title> Compatibility - - - + + + - - - 1998-09-21 - - + <refsect2 id="R2-SQL-CREATETRIGGER-4"> + <refsect2info> + <date>1998-09-21</date> + </refsect2info> + <title> SQL92 - - + + There is no CREATE TRIGGER in SQL92. - - + + + The second example above may also be done by using a FOREIGN KEY constraint as in: - - - CREATE TABLE distributors ( + + +CREATE TABLE distributors ( did DECIMAL(3), name VARCHAR(40), CONSTRAINT if_film_exists FOREIGN KEY(did) REFERENCES films ON UPDATE CASCADE ON DELETE CASCADE - ); - - +); + + + + However, foreign keys are not yet implemented (as of version 6.4) in Postgres. - + - + diff --git a/doc/src/sgml/ref/createuser.sgml b/doc/src/sgml/ref/createuser.sgml index 09b3209a13..0207b4f922 100644 --- a/doc/src/sgml/ref/createuser.sgml +++ b/doc/src/sgml/ref/createuser.sgml @@ -1,290 +1,292 @@ - - - -createuser - -Application - - - -createuser - - -Create a new Postgres user - - - - -1998-10-02 - - + + + + createuser + + Application + + + + createuser + + + Create a new Postgres user + + + + + 1998-10-02 + + createuser [ username ] createuser [ -h host ] [ -p port ] - [ -i userid ] - [ -d | -D ] [ -u | -U ] [ username ] - + [ -i userid ] [ -d | -D ] [ -u | -U ] + [ username ] + - - - 1998-10-02 - - - Inputs - - - - - - - -h host - - - - Specifies the hostname of the machine on which the - postmaster - is running. Defaults to using a local Unix domain socket - rather than an IP connection.. - - - - - - - -p port - - - - Specifies the Internet TCP/IP port or local Unix domain socket file - extension on which the postmaster - is listening for connections. The port number defaults to 5432, - or the value of the PGPORT - environment variable (if set). - - - - - - - -d - - - - Allows the user to create databases. - - - - - - - -D - - - - Forbids the user to create databases. - - - - - - - -i userid - - - - Specifies the numeric identifier to be associated with this user. - This identifier must be unique among all Postgres users, and is not required - to match the operating system UID. - You will be prompted for an identifier if none is specified on the command line, - and it will suggest an identifier matching the UID. - - - - - - - -u - - - - Allows the user to create other users. - - - - - - - -U - - - - Forbids the user to create other users. - - - - - - - username - - - - Specifies the name of the Postgres user to be created. - This name must be unique among all Postgres users. - You will be prompted for a name if none is specified on the command line. - - - - - - - + + + 1998-10-02 + + + Inputs + + - - - 1998-10-02 - - - Outputs - - - createuser will add an entry in the - pg_user or pg_shadow system table. - - - - - Connection to database 'template1' failed. - connectDB() failed: Is the postmaster running and accepting connections - at 'UNIX Socket' on port 'port'? - createuser: database access failed. - - - - createuser could not attach to the - postmaster - process on the specified host and port. If you see this message, - ensure that the postmaster - is running on the proper host and that you have specified the proper - port. If your site uses an authentication system, ensure that you - have obtained the required authentication credentials. - - - - - - - Connection to database 'template1' failed. - FATAL 1: SetUserId: user 'username' is not in 'pg_shadow' - createuser: database access failed. - - - - You do not have a valid entry in the relation pg_shadow - and and will not be allowed to access Postgres. Contact your - Postgres administrator. - - - - - - - createuser: username cannot create users. - - - - You do not have permission to create new users; contact your - Postgres site administrator. - - - - - - - createuser: user "username" already exists - - - - The user to be added already has an entry in the pg_shadow - class. - - - - - - - database access failed - - - - An internal error occurred in psql - or in the backend server. Ensure that your site administrator has - properly installed Postgresand initialized the site with - initdb. - - - - - - - - - - createuser internally runs - CREATE USER from psql - while connected to the template1 database. - - - - + + + -h host + + + Specifies the hostname of the machine on which the + postmaster + is running. Defaults to using a local Unix domain socket + rather than an IP connection. + + + + + + -p port + + + Specifies the Internet TCP/IP port or local Unix domain socket file + extension on which the postmaster + is listening for connections. The port number defaults to 5432, + or the value of the PGPORT + environment variable (if set). + + + + + + -d + + + Allows the user to create databases. + + + + + + -D + + + Forbids the user to create databases. + + + + + + -i userid + + + Specifies the numeric identifier to be associated with this user. + This identifier must be unique among all + Postgres users, and is not required + to match the operating system UID. + You will be prompted for an identifier if none is specified on the command line, + and it will suggest an identifier matching the UID. + + + + + + -u + + + Allows the user to create other users. + + + + + + -U + + + Forbids the user to create other users. + + + + + + username + + + Specifies the name of the Postgres user to be created. + This name must be unique among all Postgres users. + You will be prompted for a name if none is specified on the command line. + + + + + + + + + + 1998-10-02 + + + Outputs + + + createuser will add an entry in the + pg_user or pg_shadow system table. + + + + +Connection to database 'template1' failed. +connectDB() failed: Is the postmaster running and accepting connections at 'UNIX Socket' on port 'port'? +createuser: database access failed. + + + + createuser could not attach to the + postmaster + process on the specified host and port. If you see this message, + ensure that the postmaster + is running on the proper host and that you have specified the proper + port. If your site uses an authentication system, ensure that you + have obtained the required authentication credentials. + + + + + + +Connection to database 'template1' failed. +FATAL 1: SetUserId: user 'username' is not in 'pg_shadow' +createuser: database access failed. + + + + You do not have a valid entry in the relation pg_shadow + and and will not be allowed to access Postgres. Contact your + Postgres administrator. + + + + + + +createuser: username cannot create users. + + + + You do not have permission to create new users; contact your + Postgres site administrator. + + + + + + +createuser: user "username" already exists + + + + The user to be added already has an entry in the + pg_shadow class. + + + + + + +database access failed + + + + An internal error occurred in psql + or in the backend server. Ensure that your site administrator has + properly installed Postgresand initialized the site with + initdb. + + + + + + + + + createuser internally runs + CREATE USER from psql + while connected to the template1 database. + + + + - - - 1998-10-02 - - - Description - - - createuser creates a - new Postgres user. - Only users with usesuper set in - the pg_shadow class can create - new Postgres users. As shipped, - the user postgres can create users. - + + + 1998-10-02 + + + Description + + + createuser creates a + new Postgres user. + Only users with usesuper set in + the pg_shadow class can create + new Postgres users. As shipped, + the user postgres can create users. + + + createuser is a shell script that invokes + psql. + Hence, a postmaster + process must be running on the database server host before + createuser is executed. + The + PGOPTION + and + PGREALM + environment variables will be passed on to + psql + and processed as described in . + + + + Once invoked, createuser + will ask a series of questions to obtain parameters not specified on + the command line. The new user's database login name and a numeric + user identifier must be specified. + + - createuser is a shell script that invokes - psql. - Hence, a postmaster - process must be running on the database server host before - createuser is executed. - The - PGOPTION - and - PGREALM - environment variables will be passed on to - psql - and processed as described in . - - Once invoked, createuser - will ask a series of questions to obtain parameters not specified on - the command line. The new user's database login name and a numeric - user identifier must be specified. + The Postgres user identifier + does not need to be the same as the user's Unix UID. However, typically + they are assigned to be the same. - - - The Postgres user identifier - does not need to be the same as the user's Unix UID. However, typically - they are assigned to be the same. - - - - - You must also describe the privileges of the new user for security purposes. - Specifically, you will be asked whether the new user should be able to - act as Postgres super-user, - whether the new user may create new databases and whether the new user - is allowed to create other new users. - - - + + + + + You must also describe the privileges of the new user for security purposes. + Specifically, you will be asked whether the new user should be able to + act as Postgres super-user, + whether the new user may create new databases and whether the new user + is allowed to create other new users. + + + + + diff --git a/doc/src/sgml/ref/declare.sgml b/doc/src/sgml/ref/declare.sgml index a65ef65495..dab2d85542 100644 --- a/doc/src/sgml/ref/declare.sgml +++ b/doc/src/sgml/ref/declare.sgml @@ -1,227 +1,215 @@ - - - + + + DECLARE - - SQL - Language Statements - - - + + SQL - Language Statements + + + DECLARE - - + + Defines a cursor for table access - + - - - 1998-09-04 - - + + + 1998-09-04 + + DECLARE cursor [ BINARY ] [ INSENSITIVE ] [ SCROLL ] CURSOR FOR query [ FOR { READ ONLY | UPDATE [ OF column [, ...] ] ] - - - - 1998-04-15 - - + </synopsis> + <refsect2 id="R2-SQL-DECLARE-1"> + <refsect2info> + <date>1998-04-15</date> + </refsect2info> + <title> Inputs - - - - - - - cursor - - - - The name of the cursor to be used in subsequent FETCH operations.. - - - + + + + + cursor + + + The name of the cursor to be used in subsequent FETCH operations.. + + + - - - BINARY - - - - Causes the cursor to fetch data in binary - rather than in text format. - - - + + BINARY + + + Causes the cursor to fetch data in binary + rather than in text format. + + + - - - INSENSITIVE - - - - SQL92 keyword indicating that data retrieved -from the cursor should be unaffected by updates from other processes or cursors. -Since cursor operations occur within transactions - in Postgres this is always the case. -This keyword has no effect. - - - + + INSENSITIVE + + + SQL92 keyword indicating that data retrieved + from the cursor should be unaffected by updates from other processes or cursors. + Since cursor operations occur within transactions + in Postgres this is always the case. + This keyword has no effect. + + + - - - SCROLL - - - -SQL92 keyword indicating that data may be retrieved -in multiple rows per FETCH operation. Since this is allowed at all times -by Postgres this keyword has no effect. - - - + + SCROLL + + + SQL92 keyword indicating that data may be retrieved + in multiple rows per FETCH operation. Since this is allowed at all times + by Postgres this keyword has no effect. + + + - - - query - - - - An SQL query which will provide the rows to be governed by the - cursor. - Refer to the SELECT statement for further information about - valid arguments. - - - + + query + + + An SQL query which will provide the rows to be governed by the + cursor. + Refer to the SELECT statement for further information about + valid arguments. + + + - - - READ ONLY - - - -SQL92 keyword indicating that the cursor will be used -in a readonly mode. Since this is the only cursor access mode -available in Postgres this keyword has no effect. - - - + + READ ONLY + + + SQL92 keyword indicating that the cursor will be used + in a readonly mode. Since this is the only cursor access mode + available in Postgres this keyword has no effect. + + + - - - UPDATE - - - -SQL92 keyword indicating that the cursor will be used -to update tables. Since cursor updates are not currently -supported in Postgres this keyword -provokes an informational error message. - - - + + UPDATE + + + SQL92 keyword indicating that the cursor will be used + to update tables. Since cursor updates are not currently + supported in Postgres this keyword + provokes an informational error message. + + + - - - column - - - -Column(s) to be updated. -Since cursor updates are not currently -supported in Postgres the UPDATE clause -provokes an informational error message. - - - + + column + + + Column(s) to be updated. + Since cursor updates are not currently + supported in Postgres the UPDATE clause + provokes an informational error message. + + + - - - - - - 1998-04-15 - - - Outputs - - - - - - - SELECT - - - - The message returned if the SELECT is run successfully. - - - - - - - NOTICE - BlankPortalAssignName: portal "cursor" already exists - - - - This error occurs if cursor "cursor" is already declared. - - - - - - -ERROR: Named portals may only be used in begin/end transaction blocks - - - -This error occurs if the cursor is not declared within a transaction block. - - - - + - - - - - - 1998-09-04 - - + </refsect2> + + <refsect2 id="R2-SQL-DECLARE-2"> + <refsect2info> + <date>1998-04-15</date> + </refsect2info> + <title> + Outputs + + + + + + +SELECT + + + + The message returned if the SELECT is run successfully. + + + + + + +NOTICE +BlankPortalAssignName: portal "cursor" already exists + + + + This error occurs if cursor is already declared. + + + + + + +ERROR: Named portals may only be used in begin/end transaction blocks + + + + This error occurs if the cursor is not declared within a transaction block. + + + + + + + + + + + 1998-09-04 + + Description - - - DECLARE allows a user to create cursors, which can be used to retrieve + + + DECLARE allows a user to create cursors, which can be used to retrieve a small number of rows at a time out of a larger query. Cursors can return data either in text or in binary foramt. - - + + + Normal cursors return data in text format, either ASCII or another -encoding scheme depending on how the Postgres -backend was built. Since + encoding scheme depending on how the Postgres + backend was built. Since data is stored natively in binary format, the system must do a conversion to produce the text format. In addition, text formats are often larger in size than the corresponding binary format. Once the information comes back in text form, the client application may have to convert it to a binary format to manipulate it anyway. - - + + + BINARY cursors give you back the data in the native binary representation. So binary cursors will tend to be a little faster since they suffer less conversion overhead. + As an example, if a query returns a value of one from an integer column, -you would get a string of '1' with a default cursor -whereas with a binary cursor you would get - a 4-byte value equal to control-A ('^A'). + you would get a string of '1' with a default cursor + whereas with a binary cursor you would get + a 4-byte value equal to control-A ('^A'). + BINARY cursors should be used carefully. User applications such @@ -230,14 +218,15 @@ whereas with a binary cursor you would get - + + However, string representation is architecture-neutral whereas binary representation can differ between different machine architectures. Therefore, if your client machine and server machine use different representations (e.g. "big-endian" versus "little-endian"), - you will probably not want your data returned in + you will probably not want your data returned in binary format. - + If you intend to display the data in @@ -245,23 +234,23 @@ whereas with a binary cursor you would get effort on the client side. - - - - - 1998-09-04 - - + </para> + + <refsect2 id="R2-SQL-DECLARE-3"> + <refsect2info> + <date>1998-09-04</date> + </refsect2info> + <title> Notes - - + + Cursors are only available in transactions. - - + + Postgres does not have an explicit OPEN cursor statement; a cursor is considered to be open when it is declared. - + In SQL92 cursors are only available in @@ -271,39 +260,39 @@ whereas with a binary cursor you would get involving DECLARE and OPEN statements. - - - + + - - - + + <refsect1 id="R1-SQL-DECLARESTATEMENT-2"> + <title> Usage - - + + To declare a cursor: - - + + DECLARE liahona CURSOR FOR SELECT * FROM films; - - + + + - - + <refsect1 id="R1-SQL-DECLARESTATEMENT-3"> + <title> Compatibility - - - - - - - 1998-04-15 - - + + + + + + + 1998-04-15 + + SQL92 - - + + SQL92 allows cursors only in embedded SQL and in modules. Postgres permits cursors to be used interactively. @@ -314,12 +303,12 @@ DECLARE liahona CURSOR - + diff --git a/doc/src/sgml/ref/destroyuser.sgml b/doc/src/sgml/ref/destroyuser.sgml index 44440029d6..697e4cc0cf 100644 --- a/doc/src/sgml/ref/destroyuser.sgml +++ b/doc/src/sgml/ref/destroyuser.sgml @@ -1,244 +1,254 @@ - - - -destroyuser - -Application - - - -destroyuser - - -Destroy a Postgres user and associated databases - - - - -1998-10-02 - - + + + + destroyuser + + Application + + + + destroyuser + + + Destroy a Postgres user and associated databases + + + + + 1998-10-02 + + destroyuser [ username ] destroyuser [ -h host ] [ -p port ] [ username ] - + - - - 1998-10-02 - - - Inputs - - - - - - - -h host - - - - Specifies the hostname of the machine on which the - postmaster - is running. Defaults to using a local Unix domain socket - rather than an IP connection.. - - - - - - - -p port - - - - Specifies the Internet TCP/IP port or local Unix domain socket file - extension on which the postmaster - is listening for connections. The port number defaults to 5432, - or the value of the PGPORT - environment variable (if set). - - - - - - - username - - - - Specifies the name of the Postgres user to be removed. - This name must exist in the Postgres installation. - You will be prompted for a name if none is specified on the command line. - - - - - - - - - - - 1998-10-02 - - - Outputs - - - destroyuser will remove an entry in the - pg_user or pg_shadow system table, - and will remove all databases for which that user is the administrator - (DBA). + + + 1998-10-02 + + + Inputs + + - - - - Connection to database 'template1' failed. - connectDB() failed: Is the postmaster running and accepting connections - at 'UNIX Socket' on port 'port'? - destroyuser: database access failed. - - - - destroyuser could not attach to the - postmaster - process on the specified host and port. If you see this message, - ensure that the postmaster - is running on the proper host and that you have specified the proper - port. If your site uses an authentication system, ensure that you - have obtained the required authentication credentials. - - - - - - - Connection to database 'template1' failed. - FATAL 1: SetUserId: user 'username' is not in 'pg_shadow' - destroyuser: database access failed. - - - - You do not have a valid entry in the relation pg_shadow - and and will not be allowed to access Postgres. Contact your - Postgres administrator. - - - - - - - destroyuser: username cannot delete users. - - - - You do not have permission to delete users; contact your - Postgres site administrator. - - - + + + -h host + + + Specifies the hostname of the machine on which the + postmaster + is running. Defaults to using a local Unix domain socket + rather than an IP connection. + + + - - - destroyuser: user "username" already exists - - - - The user to be added already has an entry in the pg_shadow - class. - - - - - - - database access failed - - - - An internal error occurred in psql - or in the backend server. Ensure that your site administrator has - properly installed Postgresand initialized the site with - initdb. - - - + + -p port + + + Specifies the Internet TCP/IP port or local Unix domain socket file + extension on which the postmaster + is listening for connections. The port number defaults to 5432, + or the value of the PGPORT + environment variable (if set). + + + - - - destroydb on dbname failed - exiting - - - - An internal error occurred in psql - or in the backend server. There was possibly a Unix permissions problem with the - specified database. - - - + + username + + + Specifies the name of the Postgres user to be removed. + This name must exist in the Postgres installation. + You will be prompted for a name if none is specified on the command line. + + + + + + - - - delete of user username was UNSUCCESSFUL - - - - An internal error occurred in psql - or in the backend server. - - - + + + 1998-10-02 + + + Outputs + + + destroyuser will remove an entry in the + pg_user or pg_shadow system table, + and will remove all databases for which that user is the administrator + (DBA). - - + + + +Connection to database 'template1' failed. +connectDB() failed: Is the postmaster running and accepting connections + at 'UNIX Socket' on port 'port'? +destroyuser: database access failed. + + + + destroyuser could not attach to the + postmaster + process on the specified host and port. If you see this message, + ensure that the postmaster + is running on the proper host and that you have specified the proper + port. If your site uses an authentication system, ensure that you + have obtained the required authentication credentials. + + + - - - destroyuser internally runs - DROP USER from psql - while connected to the template1 database. - - - - - - - - 1998-10-02 - - - Description - - - destroyuser removes an existing - Postgres user - and the databases for which that user - is database administrator. - Only users with usesuper set in - the pg_shadow class can destroy - Postgres users. As shipped, - the user postgres can remove users. - + + +Connection to database 'template1' failed. +FATAL 1: SetUserId: user 'username' is not in 'pg_shadow' +destroyuser: database access failed. + + + + You do not have a valid entry in the relation pg_shadow + and and will not be allowed to access Postgres. Contact your + Postgres administrator. + + + + + + +destroyuser: username cannot delete users. + + + + You do not have permission to delete users; contact your + Postgres site administrator. + + + + + + +destroyuser: user "username" already exists + + + + The user to be added already has an entry in the + pg_shadow class. + + + + + + +database access failed + + + + An internal error occurred in psql + or in the backend server. Ensure that your site administrator has + properly installed Postgresand initialized the site with + initdb. + + + + + + +destroydb on dbname failed - exiting + + + + An internal error occurred in psql + or in the backend server. There was possibly a Unix permissions problem with the + specified database. + + + + + + +delete of user username was UNSUCCESSFUL + + + + An internal error occurred in psql + or in the backend server. + + + + + + + - destroyuser is a shell script that invokes - psql. - Hence, a postmaster - process must be running on the database server host before - destroyuser is executed. - The - PGOPTION - and - PGREALM - environment variables will be passed on to - psql - and processed as described in . + destroyuser internally runs + DROP USER from psql + while connected to the template1 database. - - Once invoked, destroyuser - will warn you about the databases that will be destroyed in the - process and permit you to abort the removal of the user if desired. - - - + + + + + + + 1998-10-02 + + + Description + + + destroyuser removes an existing + Postgres user + and the databases for which that user + is database administrator. + Only users with usesuper set in + the pg_shadow class can destroy + Postgres users. As shipped, + the user postgres can remove users. + + + destroyuser is a shell script that invokes + psql. + Hence, a postmaster + process must be running on the database server host before + destroyuser is executed. + The + PGOPTION + and + PGREALM + environment variables will be passed on to + psql + and processed as described in . + + + Once invoked, destroyuser + will warn you about the databases that will be destroyed in the + process and permit you to abort the removal of the user if desired. + + + + + diff --git a/doc/src/sgml/ref/drop_aggregate.sgml b/doc/src/sgml/ref/drop_aggregate.sgml index 2cd03ae2ff..3bdf67037f 100644 --- a/doc/src/sgml/ref/drop_aggregate.sgml +++ b/doc/src/sgml/ref/drop_aggregate.sgml @@ -1,168 +1,164 @@ - - - + + + DROP AGGREGATE - - SQL - Language Statements - - - + + SQL - Language Statements + + + DROP AGGREGATE - - + + Removes the definition of an aggregate function - + - - - 1998-04-15 - - -DROP AGGREGATE name type - - - - - 1998-04-15 - - + <refsynopsisdiv> + <refsynopsisdivinfo> + <date>1998-04-15</date> + </refsynopsisdivinfo> + <synopsis> +DROP AGGREGATE <replaceable class="PARAMETER">name</replaceable> <replaceable class="PARAMETER">type</replaceable> + </synopsis> + + <refsect2 id="R2-SQL-DROPAGGREGATE-1"> + <refsect2info> + <date>1998-04-15</date> + </refsect2info> + <title> Inputs - - - - - - - name - - - - The name of an existing aggregate function. - - - - - - type - - - - The type of an existing aggregate function. - (Refer to the PostgreSQL User's Guide for - further information about data types). - This should become a cross-reference rather than a - hard-coded chapter number - - - - - - - - - 1998-04-15 - - - Outputs - - - - - - DROP - - - - Message returned if the command is successful. - - - - - - WARN RemoveAggregate: aggregate 'name' for 'type' does not exist - - - - This message occurs if the aggregate function specified does not - exist in the database. + + + + + name + + + The name of an existing aggregate function. - + + type + + + The type of an existing aggregate function. + (Refer to the PostgreSQL User's Guide for + further information about data types). + This should become a cross-reference rather than a + hard-coded chapter number + + + + - - - - - - 1998-04-15 - - + </refsect2> + + <refsect2 id="R2-SQL-DROPAGGREGATE-2"> + <refsect2info> + <date>1998-04-15</date> + </refsect2info> + <title> + Outputs + + + + + +DROP + + + + Message returned if the command is successful. + + + + + +WARN RemoveAggregate: aggregate 'agg' for 'type' does not exist + + + + This message occurs if the aggregate function specified does not + exist in the database. + + + + + + + + + + + 1998-04-15 + + Description - - + + DROP AGGREGATE will remove all references to an existing aggregate definition. To execute this command the current user must be the owner of the aggregate. - - - - - 1998-04-15 - - + </para> + + <refsect2 id="R2-SQL-DROPAGGREGATE-3"> + <refsect2info> + <date>1998-04-15</date> + </refsect2info> + <title> Notes - - + + The DROP AGGREGATE statement is a -Postgres + Postgres language extension. - - + + Refer to the CREATE AGGREGATE statement to create aggregate functions. - - - - - - - Usage - - - To remove the myavg aggregate for type - int4: - - -DROP AGGREGATE myavg int4; - - - - - - Compatibility - - - - - - - 1998-04-15 - - - SQL92 - - - There is no DROP AGGREGATE statement in SQL92. - + - + + + + Usage + + + To remove the myavg aggregate for type + int4: + + +DROP AGGREGATE myavg int4; + + + + + + Compatibility + + + + + + + 1998-04-15 + + + SQL92 + + + There is no DROP AGGREGATE statement in SQL92. + + + + + +DROP TRIGGER if_dist_exists ON films; + + + + + + + Compatibility + + + + + + + 1998-09-22 + + + SQL92 + + + There is no DROP TRIGGER statement in + SQL92. + + + + diff --git a/doc/src/sgml/ref/fetch.sgml b/doc/src/sgml/ref/fetch.sgml index 839732c669..bd384fabed 100644 --- a/doc/src/sgml/ref/fetch.sgml +++ b/doc/src/sgml/ref/fetch.sgml @@ -1,300 +1,287 @@ - - - -FETCH - -SQL - Language Statements - - - -FETCH - - -Gets rows using a cursor - - - - -1998-09-01 - - -FETCH [ selector ] [ count ] - { IN | FROM } cursor -FETCH [ RELATIVE ] [ { [ # | ALL | NEXT | PRIOR ] } ] - FROM ] cursor - + + + + FETCH + + SQL - Language Statements + + + + FETCH + + + Gets rows using a cursor + + + + + 1998-09-01 + + +FETCH [ selector ] [ count ] { IN | FROM } cursor +FETCH [ RELATIVE ] [ { [ # | ALL | NEXT | PRIOR ] } ] FROM ] cursor + - - -1998-09-01 - - -Inputs - - + + + 1998-09-01 + + + Inputs + + - - - -selector - - - -selector -defines the fetch direction. It can be one - the following: - - - - - - - -FORWARD - - - -fetch next row(s). This is the default - if selector is omitted. - - - - - -BACKWARD - - - -fetch previous row(s). - - - - - -RELATIVE - - - -Noise word for SQL92 compatibility. - - - + + + selector + + + selector + defines the fetch direction. It can be one + the following: + + + FORWARD + + + fetch next row(s). This is the default + if selector is omitted. + + + + + BACKWARD + + + fetch previous row(s). + + + + + RELATIVE + + + Noise word for SQL92 compatibility. + + + + + + + - - -count - - - -count -determines how many rows to fetch. It can be one of the following: - - - + + count + + + count + determines how many rows to fetch. It can be one of the following: + + + # + + + A signed integer that specify how many rows to fetch. + Note that a negative integer is equivalent to changing the sense of + FORWARD and BACKWARD. + + + - - -# - - - -A signed integer that specify how many rows to fetch. -Note that a negative integer is equivalent to changing the sense of -FORWARD and BACKWARD. - - - + + + ALL + + + + Retrieve all remaining rows. + + + - - -ALL - - - -Retrieve all remaining rows. - - - + + + NEXT + + + + Equivalent to specifying a count of 1. + + + - - -NEXT - - - -Equivalent to specifying a count of 1. - - - + + + PRIOR + + + + Equivalent to specifying a count of -1. + + + + + + + - - -PRIOR - - - -Equivalent to specifying a count of -1. - - - + + cursor + + + An open cursor's name. + + + + + + - - -cursor - - - -An open cursor's name. - - - - - - + + + 1998-04-15 + + + Outputs + + + FETCH returns the results of the query defined by the specified cursor. + The following messages will be returned if the query fails: - - -1998-04-15 - - -Outputs - - -FETCH returns the results of the query defined by the specified cursor. -The following messages will be returned if the query fails: - + + + +NOTICE: PerformPortalFetch: portal "cursor" not found + + + + If cursor + is not previously declared. + The cursor must be declared within a transaction block. + + + - - - -NOTICE: PerformPortalFetch: portal "cursor" not found - - - -If cursor - is not previously declared. -The cursor must be declared within a transaction block. - - - - - - + + NOTICE: FETCH/ABSOLUTE not supported, using RELATIVE - - - -Postgres does not support absolute -positioning of cursors. - - - + + + + Postgres does not support absolute + positioning of cursors. + + + - - + + ERROR: FETCH/RELATIVE at current position is not supported - - - -SQL92 allows one to repetatively retrieve the cursor -at its "current position" using the syntax - -FETCH RELATIVE 0 FROM cursor - + + + + SQL92 allows one to repetatively retrieve the cursor + at its "current position" using the syntax + +FETCH RELATIVE 0 FROM cursor + + -Postgres does not currently support -this notion; in fact the value zero is reserved to indicate that -all rows should be retrieved and is equivalent to specifying the ALL keyword. -If the RELATIVE keyword has been used, the Postgres -assumes that the user intended SQL92 behavior -and returns this error message. - - - + + Postgres does not currently support + this notion; in fact the value zero is reserved to indicate that + all rows should be retrieved and is equivalent to specifying the ALL keyword. + If the RELATIVE keyword has been used, the Postgres + assumes that the user intended SQL92 behavior + and returns this error message. + + + - + + + + - - - - - -1998-04-15 - - -Description - - + + + 1998-04-15 + + + Description + + FETCH allows a user to retrieve rows using a cursor. The number of rows retrieved is specified by - #. + #. If the number of rows remaining in the cursor is less - than #, - then only those available are fetched. + than #, + then only those available are fetched. Substituting the keyword ALL in place of a number will cause all remaining rows in the cursor to be retrieved. Instances may be fetched in both FORWARD and BACKWARD directions. The default direction is FORWARD. - - -Negative numbers are now allowed to be specified for the -row count. A negative number is equivalent to reversing -the sense of the FORWARD and BACKWARD keywords. For example, -FORWARD -1 is the same as BACKWARD 1. - - - - -Note that the FORWARD and BACKWARD keywords are - Postgres extensions. -The SQL92 syntax is also supported, specified -in the second form of the command. See below for details -on compatibility issues. - - + + + Negative numbers are now allowed to be specified for the + row count. A negative number is equivalent to reversing + the sense of the FORWARD and BACKWARD keywords. For example, + FORWARD -1 is the same as BACKWARD 1. + + + + + Note that the FORWARD and BACKWARD keywords are + Postgres extensions. + The SQL92 syntax is also supported, specified + in the second form of the command. See below for details + on compatibility issues. + + Once all rows are fetched, every other fetch access returns no rows. - + - + Updating data in a cursor is not supported by -Postgres, + Postgres, because mapping cursor updates back to base tables is -not generally possible, as is also the case with VIEW updates. - Consequently, + not generally possible, as is also the case with VIEW updates. + Consequently, users must issue explicit UPDATE commands to replace data. - + Cursors may only be used inside of transactions because the data that they store spans multiple user queries. - + - - -1998-04-15 - - -Notes - - - Refer to MOVE statements to change cursor position. - Refer to DECLARE statements to declare a cursor. - Refer to BEGIN WORK, COMMIT WORK, ROLLBACK WORK statements - for further information about transactions. - - - + + + 1998-04-15 + + + Notes + + + Use MOVE to change cursor position. + DECLARE will define a cursor. + Refer to BEGIN, COMMIT, and + ROLLBACK + for further information about transactions. + + + - - -Usage - - - + + + Usage + + + --set up and use a cursor: -- BEGIN WORK; @@ -326,82 +313,75 @@ Usage -- CLOSE liahona; COMMIT WORK; - - - + + + - - -Compatibility - - -The non-embedded use of cursors is a Postgres -extension. The syntax and usage of cursors is being compared -against the embedded form of cursors defined in SQL92. - + + + Compatibility + + + The non-embedded use of cursors is a Postgres + extension. The syntax and usage of cursors is being compared + against the embedded form of cursors defined in SQL92. + - - -1998-09-01 - - -SQL92 - - -SQL92 allows absolute positioning of the cursor for -FETCH, and allows placing the results into explicit variables. + + + 1998-09-01 + + + SQL92 + + + SQL92 allows absolute positioning of the cursor for + FETCH, and allows placing the results into explicit variables. - -FETCH ABSOLUTE # - FROM cursor - INTO :variable [, ...] - + +FETCH ABSOLUTE # + FROM cursor + INTO :variable [, ...] + - - - -ABSOLUTE - - - -The cursor should be positioned to the specified absolute -row number. All row numbers in Postgres -are relative numbers so this capability is not supported. - - - - - -:variable - - - -Target host variable(s). - - - - - - - - + + + ABSOLUTE + + + The cursor should be positioned to the specified absolute + row number. All row numbers in Postgres + are relative numbers so this capability is not supported. + + + + + :variable + + + Target host variable(s). + + + + + + + + - diff --git a/doc/src/sgml/ref/grant.sgml b/doc/src/sgml/ref/grant.sgml index 5dd043e795..395f90061d 100644 --- a/doc/src/sgml/ref/grant.sgml +++ b/doc/src/sgml/ref/grant.sgml @@ -1,269 +1,257 @@ - - - - GRANT - - SQL - Language Statements - - - - GRANT - - - Grants access privilege to a user, a group or all users - - - - - 1998-09-23 - - - GRANT privilege [, ...] - ON object [, ...] - TO { PUBLIC | GROUP group | username } - + + + + GRANT + + SQL - Language Statements + + + + GRANT + + + Grants access privilege to a user, a group or all users + + + + + 1998-09-23 + + +GRANT privilege [, ...] ON object [, ...] + TO { PUBLIC | GROUP group | username } + - - - 1998-09-23 - - - Inputs - - - - - - - privilege - - - - The possible privileges are: - - - - - - SELECT - - - - Access all of the columns of a specific - table/view. - - - - - - - INSERT - - - - Insert data into all columns of a - specific table. - - - - - - - UPDATE - - - - Update all columns of a specific - table. - - - - - - - DELETE - - - - Delete rows from a specific table. - - - - - - - RULE - - - - Define rules on the table/view - (See CREATE RULE statement). - - - - - - - ALL - - - - Grant all privileges. - - - - - - - object - - - - The name of an object to which to grant access. - The possible objects are: - - - - - - - table - - - - - - view - - - - - - sequence - - - - - - index - - - - - - + + + 1998-09-23 + + + Inputs + + - - - PUBLIC - - - - A short form representing all users. - - - - - - GROUP group - - - - A group to whom to grant privileges. - In the current release, the group must be created explicitly as described below. - - - - - - - username - - - - The name of a user to whom grant privileges. PUBLIC is a short form - representing all users. - - - - - - + + + privilege + + + The possible privileges are: - - - 1998-09-23 - - - Outputs - - - - - - - CHANGE - - - - Message returned if successful. - - - - - - - ERROR: ChangeAcl: class "object" - not found - - - - Message returned if the specified object is not available or - if it is impossible - to give privileges to the specified group or users. - - - - - - - + + + SELECT + + + Access all of the columns of a specific + table/view. + + + - - - 1998-09-23 - - - Description - - - GRANT allows the creator of an object to give specific permissions to - all users (PUBLIC) or to a certain user or group. - Users other than the creator don't have any access permission - unless the creator GRANTs permissions, after the object - is created. - - - - Once a user has a privilege on an object, he is enabled to exercise - that privilege. - There is no need to GRANT privileges to the creator of - an object, the creator automatically holds ALL privileges, and can - also drop the object. - + + INSERT + + + Insert data into all columns of a + specific table. + + + - - - 1998-09-23 - - - Notes - - - Use the psql \z command - for further information about permissions - on existing objects: - + + UPDATE + + + Update all columns of a specific + table. + + + + + + DELETE + + + Delete rows from a specific table. + + + + + + RULE + + + Define rules on the table/view + (See CREATE RULE statement). + + + + + + ALL + + + Grant all privileges. + + + + + + + + + + object + + + The name of an object to which to grant access. + The possible objects are: + + + + + table + + + + + + view + + + + + + sequence + + + + + + index + + + + + + + + + PUBLIC + + + A short form representing all users. + + + + + + GROUP group + + + A group to whom to grant privileges. + In the current release, the group must be created explicitly as described below. + + + + + + + username + + + + The name of a user to whom grant privileges. PUBLIC is a short form + representing all users. + + + + + + + + + + 1998-09-23 + + + Outputs + + + + + + +CHANGE + + + + Message returned if successful. + + + + + + +ERROR: ChangeAcl: class "object" not found + + + + Message returned if the specified object is not available or + if it is impossible + to give privileges to the specified group or users. + + + + + + + + + + + 1998-09-23 + + + Description + + + GRANT allows the creator of an object to give specific permissions to + all users (PUBLIC) or to a certain user or group. + Users other than the creator don't have any access permission + unless the creator GRANTs permissions, after the object + is created. + + + + Once a user has a privilege on an object, he is enabled to exercise + that privilege. + There is no need to GRANT privileges to the creator of + an object, the creator automatically holds ALL privileges, and can + also drop the object. + + + + + 1998-09-23 + + + Notes + + + + Currently, to grant privileges in Postgres + to only few columns, you must + create a view having desired columns and then grant privileges + to that view. + + + + Use psql \z + for further information about permissions + on existing objects: + Database = lusitania +------------------+---------------------------------------------+ | Relation | Grant/Revoke Permissions | @@ -280,229 +268,204 @@ a -- INSERT R -- RULE arwR -- ALL - + - - - Currently, to create a GROUP you have to insert - data manually into table pg_group as: - - INSERT INTO pg_group VALUES ('todos'); - CREATE USER miriam IN GROUP todos; - - Refer to REVOKE statements to revoke access privileges. - - - - - - - - - Usage - - - - -- grant insert privilege to all users on table films: - -- - GRANT INSERT ON films TO PUBLIC; - - + + + Currently, to create a GROUP you have to insert + data manually into table pg_group as: - -- grant all privileges to user manuel on view kinds: - -- - GRANT ALL ON kinds TO manuel; - - - +INSERT INTO pg_group VALUES ('todos'); +CREATE USER miriam IN GROUP todos; + + + + - - - Compatibility - - - + + Refer to REVOKE statements to revoke access privileges. + + + + + + + Usage + + + Grant insert privilege to all users on table films: + + +GRANT INSERT ON films TO PUBLIC; + + + + + Grant all privileges to user manuel on view kinds: + + +GRANT ALL ON kinds TO manuel; + + + + + + + Compatibility + + + - - - 1998-09-23 - - - SQL92 - - - The SQL92 syntax for GRANT allows setting privileges - for individual columns - within a table, and allows setting a privilege to grant - the same privileges to others. - - - GRANT privilege [, ...] - ON object [ ( column [, ...] ) ] [, ...] - TO { PUBLIC | username [, ...] } - [ WITH GRANT OPTION ] - - - Fields are compatible with the those in the Postgres - implementation, with the following additions: - - - - - privilege - SELECT - - - - SQL92 permits additional privileges to be specified: - - - - - - - REFERENCES - - - - Allowed to reference some or all of the columns of a specific - table/view in integrity constraints. - - - - - - - USAGE - - - - Allowed to use a domain, character set, collation - or translation. - If an object specifies anything other than a table/view, - privilege - must specify only USAGE. - - - - - - - - - Currently, to grant privileges in Postgres - to only few columns, you must - create a view having desired columns and then grant privileges - to that view. - - - - - - - object - - - - - - - - object - - - - SQL92 allows an additional non-functional keyword: - - - - [ TABLE ] table - - - - - - - - - CHARACTER SET - - - - Allowed to use the specified character set. - - - - - - - COLLATION - - - - Allowed to use the specified collation sequence. - - - - - - - TRANSLATION - - - - Allowed to use the specified character set translation. - - - - - - - DOMAIN - - - - Allowed to use the specified domain. - - - - - - - WITH GRANT OPTION - - - - Allowed to grant the same privilege to others. - - - - - - - - - - - - + + + 1998-09-23 + + + SQL92 + + + The SQL92 syntax for GRANT allows setting privileges + for individual columns + within a table, and allows setting a privilege to grant + the same privileges to others: - diff --git a/doc/src/sgml/ref/initdb.sgml b/doc/src/sgml/ref/initdb.sgml index 19ee8d88dc..f8702f2779 100644 --- a/doc/src/sgml/ref/initdb.sgml +++ b/doc/src/sgml/ref/initdb.sgml @@ -1,313 +1,315 @@ - - - -initdb - -Application - - - -initdb - - -Create a new Postgres database installation - - - - -1998-10-02 - - + + + + initdb + + Application + + + + initdb + + + Create a new Postgres database installation + + + + + 1998-10-02 + + initdb [ --pgdata=dbdir | -r dbdir ] [ --pglib=libdir | -l libdir ] [ --template=template | -t template ] [ --username=name | -u name ] [ --noclean | -n ] [ --debug | -d ] - + - - - 1998-10-02 - - - Inputs - - - - - - --pglib=libdir - - - -l libdir - - - PGLIB - - - - Where are the files that make up Postgres? - Apart from files that - have to go in particular directories because of their function, the - files that make up the Postgres software - were installed in a directory - called the libdir directory. - An example of a file that will be found - there that initdb - needs is global1.bki.source, - which contains all the information that goes - into the shared catalog tables. - - - - - - - --pgdata=dbdir - - - -r dbdir - - - PGDATA - - - - Where in your Unix filesystem do you want the database data to go? - The top level directory is called the PGDATA directory. - - - - - - - --username=name - - - -u name - - - PGUSER - - - - Who will be the Postgres superuser - for this database system? The - Postgres superuser is a Unix user - who owns all files that store the database - system and also owns the postmaster and backend processes that access them. - Or just let it default to you (the Unix user who runs - initdb). - - - - Only the Unix superuser (root) - can create a database system with an owner - different from the Postgres superuser. - - - - - - - - Other, less commonly used, parameters are also available: - - - - - --template=template - - - -t template - - - - Replace the template1 - database in an existing database system, and don't touch anything else. - This is useful when you need to upgrade your template1 - database using initdb - from a newer release of Postgres, - or when your template1 - database has become corrupted by some system problem. Normally the - contents of template1 - remain constant throughout the life of the database system. You can't - destroy anything by running initdb - with the - - option. - - - - - - - --noclean - - - -n - - - - By default, when initdb - determines that error prevent it from completely creating the database - system, it removes any files it may have created before determining - that it can't finish the job. That includes any core files left by - the programs it invokes. This option inhibits any tidying-up and is - thus useful for debugging. - - - - - - - --debug - - - -d - - - - Print debugging output from the bootstrap backend. - The bootstrap backend is the program initdb - uses to create the catalog tables. This option generates a tremendous - amount of output. It also turns off the final vacuuming step. - - - - - - - - Files are also input to initdb: - - - - - postconfig - - - - If appearing somewhere in the Unix command search path - (defined by the PATH environment variable). - This is a program that specifies defaults for some of the - command options. See below. - - - - - - - PGLIB/global1.bki.source - - - - Contents for the shared catalog tables in the new database system. This - file is part of the Postgres software. - - - - - - - PGLIB/local1_template1.bki.source - - - - Contents for the template1 tables in the new database system. This - file is part of the Postgres software. - - - - - - - + + + 1998-10-02 + + + Inputs + + - - - 1998-09-26 - - - Outputs - - - initdb will create files in the PGDATA - data area which are the system tables and framework for a complete - installation. - - - + + + --pglib=libdir + -l libdir + PGLIB + + + Where are the files that make up Postgres? + Apart from files that + have to go in particular directories because of their function, the + files that make up the Postgres software + were installed in a directory + called the libdir directory. + An example of a file that will be found + there that initdb + needs is global1.bki.source, + which contains all the information that goes + into the shared catalog tables. + + + - - - 1998-09-26 - - - Description - - - initdb creates a new - Postgres database system. - A database system is a - collection of databases that are all administered by the same Unix user - and managed by a single postmaster. - - - Creating a database system consists of creating the directories in which - the database data will live, generating the shared catalog tables - (tables that don't belong to any particular database), and - creating the template1 - database. What is the template1 - database? When you create a database, Postgres - does it by copying - everything from the template1 - database. It contains catalog tables filled in for things like the - builtin types. - - - After initdb - creates the database, it completes the initialization by running - vacuum, which resets some optimization parameters. - - - There are three ways to give parameters to initdb. - - First, you can use initdb command options. - Second, you can set environment - variables before invoking initdb. - Third, you can have a program called postconfig - in your Unix command search path. + + --pgdata=dbdir + -r dbdir + PGDATA + + + Where in your Unix filesystem do you want the database data to go? + The top level directory is called the PGDATA directory. + + + + + + --username=name + -u name + PGUSER + + + Who will be the Postgres superuser + for this database system? The + Postgres superuser is a Unix user + who owns all files that store the database + system and also owns the postmaster and backend processes that access them. + Or just let it default to you (the Unix user who runs + initdb). + + + + Only the Unix superuser (root) + can create a database system with an owner + different from the Postgres superuser. + + + + + + + + + Other, less commonly used, parameters are also available: + + + + --template=template + -t template + + + Replace the template1 + database in an existing database system, and don't touch anything else. + This is useful when you need to upgrade your template1 + database using initdb + from a newer release of Postgres, + or when your template1 + database has become corrupted by some system problem. Normally the + contents of template1 + remain constant throughout the life of the database system. You can't + destroy anything by running initdb + with the + + option. + + + + + + --noclean + -n + + + By default, when initdb + determines that error prevent it from completely creating the database + system, it removes any files it may have created before determining + that it can't finish the job. That includes any core files left by + the programs it invokes. This option inhibits any tidying-up and is + thus useful for debugging. + + + + + + --debug + -d + + + Print debugging output from the bootstrap backend. + The bootstrap backend is the program initdb + uses to create the catalog tables. This option generates a tremendous + amount of output. It also turns off the final vacuuming step. + + + + + + + + + Files are also input to initdb: + + + + postconfig + + + If appearing somewhere in the Unix command search path + (defined by the PATH environment variable). + This is a program that specifies defaults for some of the + command options. See below. + + + + + + PGLIB/global1.bki.source + + + Contents for the shared catalog tables in the new database system. This + file is part of the Postgres software. + + + + + + PGLIB/local1_template1.bki.source + + + Contents for the template1 tables in the new database system. This + file is part of the Postgres software. + + + + + + + + + + + 1998-09-26 + + + Outputs + + + initdb will create files in the + PGDATA + data area which are the system tables and framework for a complete + installation. + + + + + + + 1998-09-26 + + + Description + + + initdb creates a new + Postgres database system. + A database system is a + collection of databases that are all administered by the same Unix user + and managed by a single postmaster. + + + Creating a database system consists of creating the directories in which + the database data will live, generating the shared catalog tables + (tables that don't belong to any particular database), and + creating the template1 + database. What is the template1 + database? When you create a database, Postgres + does it by copying + everything from the template1 + database. It contains catalog tables filled in for things like the + builtin types. + + + After initdb + creates the database, it completes the initialization by running + vacuum, which resets some optimization parameters. + + + There are three ways to give parameters to initdb. + + + + + You can use initdb command options. + + + + + You can set environment + variables before invoking initdb. + + + + + + You can have a program called postconfig + in your Unix command search path. initdb invokes that program and that program then writes initdb parameters to its standard output stream. This third option is not a common thing to do, however. - - - Command options always override parameters specified any other way. - The values returned by postconfig - override any environment variables, but your - postconfig - program may base its output on the environment variables if you want - their values to be used. - - - The value that postconfig - outputs must have the format - - var1=value1 var2=value2 ... - - - It can output nothing if it doesn't want to supply any parameters. - The var values are equal to - the corresponding environment variable - names. For example, - - PGDATA=/tmp/postgres_test - - has the - same effect as invoking initdb - with an environment variable called PGDATA whose value is - /tmp/postgres_test. - - - + + + + + + + Command options always override parameters specified any other way. + The values returned by postconfig + override any environment variables, but your + postconfig + program may base its output on the environment variables if you want + their values to be used. + + + + The value that postconfig + outputs must have the format + +var1=value1 var2=value2 ... + + + It can output nothing if it doesn't want to supply any parameters. + The var values are equal to + the corresponding environment variable + names. For example, + +PGDATA=/tmp/postgres_test + + has the + same effect as invoking initdb + with an environment variable called PGDATA whose value is + /tmp/postgres_test. + + + + + diff --git a/doc/src/sgml/ref/initlocation.sgml b/doc/src/sgml/ref/initlocation.sgml index 687f5e81ef..5d47009843 100644 --- a/doc/src/sgml/ref/initlocation.sgml +++ b/doc/src/sgml/ref/initlocation.sgml @@ -1,228 +1,233 @@ - - - -initlocation - -Application - - - -initlocation - - -Create a secondary Postgres database storage area - - - - -1998-10-02 - - -initlocation [ --location=altdir | -D altdir ] + + + + initlocation + + Application + + + + initlocation + + + Create a secondary Postgres database storage area + + + + + 1998-10-02 + + +initlocation [ --location=er">alble> | -D altdir ] [ --username=name | -u name ] [ altdir ] - + - - - 1998-10-02 - - - Inputs - - - - - - - --location=altdir - - - -D altdir - - - altdir - - - - Where in your Unix filesystem do you want alternate databases to go? - The top level directory is called the PGDATA directory, so you - might want to point your first alternate location at PGDATA2. - - - - - - - --username=name - - - -u name - - - PGUSER - - - - Who will be the Unix filesystem owner of this database storage area? - The - Postgres superuser is a Unix user - who owns all files that store the database - system and also owns the postmaster and backend processes that access them. - Usually, this is the user who should run initlocation - and who will thus have ownership of the directories and files. - - - - Only the Unix superuser can create a database system with a - different user as the Postgres superuser. - Specifying a user other than the Postgres superuser - may lead to database security and data integrity problems. Refer to the - PostgreSQL Administrator's Guide - for more information. - - - - - - - - - - - - 1998-09-26 - - - Outputs - - - initlocation will create directories in - the specified place. - - - - - We are initializing the database area with username postgres (uid=500). - This user will own all the files and must also own the server process. - Creating Postgres database system directory altdir - Creating Postgres database system directory altdir - - - - Successful completion. - - - - - - - We are initializing the database area with username postgres (uid=500). - This user will own all the files and must also own the server process. - Creating Postgres database system directory /usr/local/src/testlocation - mkdir: cannot make directory `altdir': Permission denied - - - - You do not have filesystem permission to write to the specified directory area. - - - - - - - Valid username not given. You must specify the username for - the Postgres superuser for the database system you are - initializing, either with the --username option or by default - to the USER environment variable. - - - - The username which you have specified is not the - Postgres superuser. - - - - - - - Can't tell what username to use. You don't have the USER - environment variable set to your username and didn't specify the - --username option - - - - Specify the command line option. - - - - - - - - + + + 1998-10-02 + + + Inputs + + - - - 1998-09-26 - - - Description - - - initlocation - creates a new Postgres secondary database storage area. - A secondary storage area contains a required tree of directories with - the correct file permissions on those directories. - - - Creating a database storage area consists of creating the directories in which - database data might live. - - - There are two kinds of arguments for initlocation. - First, you can specify an environment variable (e.g. PGDATA2). - This environment variable should be known to the backend for later use in - CREATE DATABASE/WITH LOCATION - or - createdb -D altdir. - However, the backend daemon must have this variable in it's - environment for this to succeed. - - Second, you may be able to specify an explicit - absolute path to the top directory of the storage area. However,this second - option is possible only if explicitly enabled during the - Postgres installation. It is usually disabled - to alleviate security and data integrity concerns. - - - - Postgres will add /base/ - to the specified path to create the storage area. - - - The backend requires that any argument to which is - in all uppercase and which has no path delimiters is an environment variable. - - - + + + --location=altdir + -D altdir + altdir + + + Where in your Unix filesystem do you want alternate databases to go? + The top level directory is called the PGDATA directory, so you + might want to point your first alternate location at + PGDATA2. + + + - - - 1998-09-26 - - - Usage - - - To create a database in an alternate location, using an environment variable: + + --username=name + -u name + PGUSER + + + Who will be the Unix filesystem owner of this database storage area? + The + Postgres superuser is a Unix user + who owns all files that store the database + system and also owns the postmaster and backend processes that access them. + Usually, this is the user who should run initlocation + and who will thus have ownership of the directories and files. + + + + Only the Unix superuser can create a database system with a + different user as the Postgres superuser. + Specifying a user other than the Postgres superuser + may lead to database security and data integrity problems. Refer to the + PostgreSQL Administrator's Guide + for more information. + + + + + + + - - % setenv PGDATA2 /opt/postgres/data - - % initlocation PGDATA2 - % createdb -D PGDATA2 - - - - + + + 1998-09-26 + + + Outputs + + + initlocation will create directories in + the specified place. + + + + +We are initializing the database area with username postgres (uid=500). +This user will own all the files and must also own the server process. +Creating Postgres database system directory altdir +Creating Postgres database system directory altdir + + + + Successful completion. + + + + + + +We are initializing the database area with username postgres (uid=500). +This user will own all the files and must also own the server process. +Creating Postgres database system directory /usr/local/src/testlocation +mkdir: cannot make directory `altdir': Permission denied + + + + You do not have filesystem permission to write to the specified directory area. + + + + + + +Valid username not given. You must specify the username for +the Postgres superuser for the database system you are +initializing, either with the --username option or by default +to the USER environment variable. + + + + The username which you have specified is not the + Postgres superuser. + + + + + + +Can't tell what username to use. You don't have the USER +environment variable set to your username and didn't specify the +--username option + + + + Specify the command line option. + + + + + + + + + + + + 1998-09-26 + + + Description + + + initlocation + creates a new Postgres secondary database storage area. + A secondary storage area contains a required tree of directories with + the correct file permissions on those directories. + + + Creating a database storage area consists of creating the directories in which + database data might live. + + + There are two kinds of arguments for initlocation. + + First, you can specify an environment variable (e.g. PGDATA2). + This environment variable should be known to the backend for later use in + CREATE DATABASE/WITH LOCATION + or + createdb -D altdir. + However, the backend daemon must have this variable in it's + environment for this to succeed. + + Second, you may be able to specify an explicit + absolute path to the top directory of the storage area. However,this second + option is possible only if explicitly enabled during the + Postgres installation. It is usually disabled + to alleviate security and data integrity concerns. + + + + Postgres will add /base/ + to the specified path to create the storage area. + + + The backend requires that any argument to which is + in all uppercase and which has no path delimiters is an environment variable. + + + + + + + 1998-09-26 + + + Usage + + + To create a database in an alternate location, using an environment variable: + + +% setenv PGDATA2 /opt/postgres/data +% initlocation PGDATA2 +% createdb -D PGDATA2 + + + + + + diff --git a/doc/src/sgml/ref/insert.sgml b/doc/src/sgml/ref/insert.sgml index b5e2c0241e..2860f89e1e 100644 --- a/doc/src/sgml/ref/insert.sgml +++ b/doc/src/sgml/ref/insert.sgml @@ -1,237 +1,235 @@ - - - -INSERT - -SQL - Language Statements - - - -INSERT - - -Inserts new rows into a table - + + + + INSERT + + SQL - Language Statements + + + + INSERT + + + Inserts new rows into a table + - - - 1998-09-23 - - - INSERT INTO table [ ( column [, ...] ) ] - { VALUES ( expression [, ...] ) | SELECT query } - + + + 1998-09-23 + + +INSERT INTO table [ ( column [, ...] ) ] + { VALUES ( expression [, ...] ) | SELECT query } + - - - 1998-09-23 - - + <refsect2 id="R2-SQL-INSERT-1"> + <refsect2info> + <date>1998-09-23</date> + </refsect2info> + <title> Inputs - - - - - - - table - - - - The name of an existing table. - - - - - - column - - - - The name of a column in table. - - - - - - - expression - - - - A valid expression or value to assign to column. - - - - - - - query - - - - A valid query. Refer to the SELECT statement for a further description - of valid arguments. - - - - - - - - - - - 1998-09-23 - - - Outputs - - - - - - - INSERT oid 1 - - - - Message returned if only one row was inserted. - oid - is the numeric OID of the inserted row. - - - - - - INSERT 0 # - - - - Message returned if more than one rows were inserted. - # - is the number of rows inserted. - - - - - - - - - - - 1998-09-02 - - - Description - - - INSERT allows one to insert new rows into a table. One can insert - a single row at time or several rows as a result of a query. - The columns in the target list may be listed in any order. - In every column not present in the target list will be inserted - the default value, if column has not a declared default value - it will be assumed as NULL. If the expression for each column - is not of the correct data type, automatic type coercion will be - attempted. - - - You must have insert privilege to a table in order to append - to it, as well as select privilege on any table specified - in a WHERE clause. - - + + - - - Usage - - - - --Insert a single row into table films; - --(in the second example the column date_prod is omitted - --therefore will be stored in it a default value of NULL): - -- - INSERT INTO films VALUES - ('UA502','Bananas',105,'1971-07-13','Comedy',INTERVAL '82 minute'); - - INSERT INTO films (code, title, did, date_prod, kind) - VALUES ('T_601', 'Yojimbo', 106, DATE '1961-06-16', 'Drama'); - - - - --Insert a single row into table distributors, note that - --only column "name" is specified, to the non specified - --column "did" will be assigned its default value: - -- - INSERT INTO distributors (name) VALUES ('British Lion'); - - - - --Insert several rows into table films from table tmp: - -- - INSERT INTO films - SELECT * FROM tmp; - - - - --Insert into arrays: - --Create an empty 3x3 gameboard for noughts-and-crosses - --(all of these queries create the same board attribute) - --(Refer to the PostgreSQL User's Guide for further - --information about arrays). - - INSERT INTO tictactoe (game, board[1:3][1:3]) - VALUES (1,'{{"","",""},{},{"",""}}'); - INSERT INTO tictactoe (game, board[3][3]) - VALUES (2,'{}'); - INSERT INTO tictactoe (game, board) - VALUES (3,'{{,,},{,,},{,,}}'); - - - + + + table + + + The name of an existing table. + + + + + column + + + The name of a column in table. + + + + + + expression + + + A valid expression or value to assign to column. + + + + + + query + + + A valid query. Refer to the SELECT statement for a further description + of valid arguments. + + + + + + - - - Compatibility - - - + + + 1998-09-23 + + + Outputs + + + + + + +INSERT oid 1 + + + + Message returned if only one row was inserted. + oid + is the numeric OID of the inserted row. + + + + + +INSERT 0 # + + + + Message returned if more than one rows were inserted. + # + is the number of rows inserted. + + + + + + + + + + + 1998-09-02 + + + Description + + + INSERT allows one to insert new rows into a table. One can insert + a single row at time or several rows as a result of a query. + The columns in the target list may be listed in any order. + In every column not present in the target list will be inserted + the default value, if column has not a declared default value + it will be assumed as NULL. If the expression for each column + is not of the correct data type, automatic type coercion will be + attempted. + + + You must have insert privilege to a table in order to append + to it, as well as select privilege on any table specified + in a WHERE clause. + + + + + + Usage + + + Insert a single row into table films: + + +INSERT INTO films VALUES + ('UA502','Bananas',105,'1971-07-13','Comedy',INTERVAL '82 minute'); + + + + + In this second example the column date_prod is + omitted and therefore it will have the default value of NULL: + + +INSERT INTO films (code, title, did, date_prod, kind) + VALUES ('T_601', 'Yojimbo', 106, DATE '1961-06-16', 'Drama'); + + + + + Insert a single row into table distributors; note that + only column name is specified, so the omitted + column did will be assigned its default value: + + +INSERT INTO distributors (name) VALUES ('British Lion'); + + + + + Insert several rows into table films from table tmp: + + +INSERT INTO films SELECT * FROM tmp; + + + + + Insert into arrays (refer to The PostgreSQL User's Guide for further + information about arrays): + + +-- Create an empty 3x3 gameboard for noughts-and-crosses +-- (all of these queries create the same board attribute) +INSERT INTO tictactoe (game, board[1:3][1:3]) + VALUES (1,'{{"","",""},{},{"",""}}'); +INSERT INTO tictactoe (game, board[3][3]) + VALUES (2,'{}'); +INSERT INTO tictactoe (game, board) + VALUES (3,'{{,,},{,,},{,,}}'); + + + + + + + Compatibility + + + - - - 1998-09-23 - - - SQL92 - - - The INSERT statement is fully compatible with SQL92. - Possible limitations in features of the - query - clause are documented for the SELECT statement. - - - - + + + 1998-09-23 + + + SQL92 + + + INSERT is fully compatible with SQL92. + Possible limitations in features of the + query + clause are documented for the SELECT statement. + + + + - diff --git a/doc/src/sgml/ref/listen.sgml b/doc/src/sgml/ref/listen.sgml index 1a110074f8..1cb5d259f1 100644 --- a/doc/src/sgml/ref/listen.sgml +++ b/doc/src/sgml/ref/listen.sgml @@ -1,185 +1,199 @@ - - - -LISTEN - -SQL - Language Statements - - - -LISTEN - - -Listen for notification on a notify condition - - - - -1998-10-07 - - -LISTEN notifyname - + + + + LISTEN + + SQL - Language Statements + + + + LISTEN + + + Listen for a response on a notify condition + + + + + 1998-10-07 + + +LISTEN name + - - - 1998-10-07 - - - Inputs - - - - - - - notifyname - - - - Name of notify condition. - - - - - - - - - - 1998-09-24 - - - Outputs - - - - - - - LISTEN - - - - Message returned upon successful completion of registration. - - - - - - NOTICE Async_Listen: We are already listening on notifyname - - - - If this backend is already registered for that notify condition. - - - - - - - - - - - 1998-10-07 - - - Description - - - LISTEN registers the current Postgres backend as a - listener on the notify condition - notifyname. - - - Whenever the command - NOTIFY notifyname - is invoked, either by this backend or another one connected to - the same database, all the backends currently listening on that notify - condition are notified, and each will in turn notify its connected - frontend application. See the discussion of NOTIFY - for more information. - - - A backend can be deregistered for a given notify condition with the - UNLISTEN command. Also, a backend's listen registrations - are automatically cleared when the backend process exits. - - - The method a frontend application must use to detect notify events depends on - which Postgres application programming interface it - uses. With the basic libpq library, the application issues - LISTEN as an ordinary SQL command, and then must - periodically call the routine PQnotifies to find out - whether any notify events have been received. Other interfaces such as - libpgtcl provide higher-level methods for handling notify events; indeed, - with libpgtcl the application programmer should not even issue - LISTEN or UNLISTEN directly. See the - documentation for the library you are using for more details. - - - The reference page for NOTIFY contains a more extensive - discussion of the use of LISTEN and - NOTIFY. - - - - - 1998-10-07 - - - Notes - - - notifyname - can be any string valid as a name; - it need not correspond to the name of any actual table. If - notifyname - is enclosed in double-quotes, it need not even be a syntactically - valid name, but can be any string up to 31 characters long. - - - In some previous releases of - Postgres, - notifyname - had to be enclosed in double-quotes when it did not correspond to any existing - table name, even if syntactically valid as a name. That is no longer required. - - - - - - - Usage - - - - -- Configure and execute a listen/notify sequence from psql - postgres=> listen virtual; - LISTEN - postgres=> notify virtual; - NOTIFY - ASYNC NOTIFY of 'virtual' from backend pid '11239' received - - - - - - - Compatibility - - - - - 1998-09-01 - - - SQL92 - - - There is no LISTEN in SQL92. - - - - + + + 1998-10-07 + + + Inputs + + + + + + name + + + Name of notify condition. + + + + + + + + + + 1998-09-24 + + + Outputs + + + + + + +LISTEN + + + + Message returned upon successful completion of registration. + + + + + +NOTICE Async_Listen: We are already listening on name + + + + If this backend is already registered for that notify condition. + + + + + + + + + + + 1998-10-07 + + + Description + + + LISTEN registers the current Postgres backend as a + listener on the notify condition + name. + + + Whenever the command + NOTIFY name + is invoked, either by this backend or another one connected to + the same database, all the backends currently listening on that notify + condition are notified, and each will in turn notify its connected + frontend application. See the discussion of NOTIFY + for more information. + + + A backend can be unregistered for a given notify condition with the + UNLISTEN command. Also, a backend's listen registrations + are automatically cleared when the backend process exits. + + + The method a frontend application must use to detect notify events depends on + which Postgres application programming interface it + uses. With the basic libpq library, the application issues + LISTEN as an ordinary SQL command, and then must + periodically call the routine PQnotifies to find out + whether any notify events have been received. Other interfaces such as + libpgtcl provide higher-level methods for handling notify events; indeed, + with libpgtcl the application programmer should not even issue + LISTEN or UNLISTEN directly. See the + documentation for the library you are using for more details. + + + The reference page for NOTIFY contains a more extensive + discussion of the use of LISTEN and + NOTIFY. + + + + + 1998-10-07 + + + Notes + + + name + can be any string valid as a name; + it need not correspond to the name of any actual table. If + notifyname + is enclosed in double-quotes, it need not even be a syntactically + valid name, but can be any string up to 31 characters long. + + + In some previous releases of + Postgres, + name + had to be enclosed in double-quotes when it did not correspond to any existing + table name, even if syntactically valid as a name. That is no longer required. + + + + + + + Usage + + + Configure and execute a listen/notify sequence from psql: + +LISTEN virtual; +NOTIFY virtual; + +ASYNC NOTIFY of 'virtual' from backend pid '11239' received + + + + + + + Compatibility + + + + + 1998-09-01 + + + SQL92 + + + There is no LISTEN in SQL92. + + + + + + diff --git a/doc/src/sgml/ref/load.sgml b/doc/src/sgml/ref/load.sgml index fc2f04ed51..77a154c7c4 100644 --- a/doc/src/sgml/ref/load.sgml +++ b/doc/src/sgml/ref/load.sgml @@ -1,179 +1,192 @@ - - - - LOAD - - SQL - Language Statements - - - - LOAD - - - Dynamically loads an object file - - - - - 1998-09-24 - - - - - LOAD 'filename' - + + + + LOAD + + SQL - Language Statements + + + + LOAD + + + Dynamically loads an object file + + + + + 1998-09-24 + + +LOAD 'filename' + - - - 1998-09-01 - - - Inputs - - - - - - - filename - - - - Object file for dynamic loading. - - - - + + + 1998-09-01 + + + Inputs + + + + + filename + + + Object file for dynamic loading. + + + + + + - + + + 1998-09-24 + + + Outputs + + - - - 1998-09-24 - - - Outputs - - - - - - - LOAD - - - - Message returned on successful completion. - - - - - - ERROR: LOAD: could not open file 'filename' - - - - Message returned if the specified file is not found. The file must be visible - to the Postgres backend, - with the appropriate full path name specified, to avoid this message. - - - - - - - - - - - 1998-09-24 - - - Description - - - Loads an object (or ".o") file into the - Postgres backend address space. Once a - file is loaded, all functions in that file can be accessed. This - function is used in support of user-defined types and functions. - - - If a file is not loaded using - LOAD, - the file will be loaded automatically the first time the - function is called by Postgres. - LOAD - can also be used to reload an object file if it has been edited and - recompiled. Only objects created from C language files are supported - at this time. - - - - 1998-09-24 - - - Notes - - - Functions in loaded object files should not call functions in other - object files loaded through the - LOAD - command. For example, all functions in file A should - call each other, functions in the standard or math libraries, or in - Postgres itself. They should not call functions defined in a different - loaded file B. - This is because if B is reloaded, the Postgres loader is - not able to relocate the calls from the functions in A into - the new address space of B. - If B is not reloaded, however, there will - not be a problem. - - - Object files must be compiled to contain position independent code. - For example, - on DECstations you must use - /bin/cc - with the -G 0 option when compiling object files to be - loaded. - - - Note that if you are porting Postgres - to a new platform, LOAD - will have to work in order to support ADTs. - - - + + + +LOAD + + + + Message returned on successful completion. + + + + + +ERROR: LOAD: could not open file 'filename' + + + + Message returned if the specified file is not found. The file must be visible + to the Postgres backend, + with the appropriate full path name specified, to avoid this message. + + + + + + + - - - Usage - - - - --Load the file /usr/postgres/demo/circle.o - -- - LOAD '/usr/postgres/demo/circle.o' - - - - - - - Compatibility - - - - - - - 1998-09-24 - - - SQL92 - - - There is no LOAD in SQL92. - - - - + + + 1998-09-24 + + + Description + + + Loads an object (or ".o") file into the + Postgres backend address space. Once a + file is loaded, all functions in that file can be accessed. This + function is used in support of user-defined types and functions. + + + If a file is not loaded using + LOAD, + the file will be loaded automatically the first time the + function is called by Postgres. + LOAD + can also be used to reload an object file if it has been edited and + recompiled. Only objects created from C language files are supported + at this time. + + + + 1998-09-24 + + + Notes + + + Functions in loaded object files should not call functions in other + object files loaded through the + LOAD + command. For example, all functions in file A should + call each other, functions in the standard or math libraries, or in + Postgres itself. They should not call functions defined in a different + loaded file B. + This is because if B is reloaded, the Postgres loader is + not able to relocate the calls from the functions in + A into + the new address space of B. + If B is not reloaded, however, there will + not be a problem. + + + Object files must be compiled to contain position independent code. + For example, + on DECstations you must use + /bin/cc + with the -G 0 option when compiling object files to be + loaded. + + + Note that if you are porting Postgres + to a new platform, LOAD + will have to work in order to support ADTs. + + + + + + + Usage + + + Load the file /usr/postgres/demo/circle.o: + + +LOAD '/usr/postgres/demo/circle.o' + + + + + + + Compatibility + + + + + + + 1998-09-24 + + + SQL92 + + + There is no LOAD in SQL92. + + + + + + diff --git a/doc/src/sgml/ref/lock.sgml b/doc/src/sgml/ref/lock.sgml index b8fb1c4611..9147f6a085 100644 --- a/doc/src/sgml/ref/lock.sgml +++ b/doc/src/sgml/ref/lock.sgml @@ -34,9 +34,7 @@ LOCK [ TABLE ] table IN SHARE ROW E - - table - + table The name of an existing table to lock. @@ -45,17 +43,15 @@ LOCK [ TABLE ] table IN SHARE ROW E - - ACCESS SHARE MODE - + ACCESS SHARE MODE - - This lock mode is acquired automatically over tables being queried. - Postgres releases automatically acquired - ACCESS SHARE locks after the statement is done. - - + + This lock mode is acquired automatically over tables being queried. + Postgres releases automatically acquired + ACCESS SHARE locks after the statement is done. + + This is the least restrictive lock mode which conflicts only with @@ -68,9 +64,7 @@ LOCK [ TABLE ] table IN SHARE ROW E - - ROW SHARE MODE - + ROW SHARE MODE @@ -85,12 +79,10 @@ LOCK [ TABLE ] table IN SHARE ROW E - - ROW EXCLUSIVE MODE - + ROW EXCLUSIVE MODE - + Automatically acquired by any UPDATE, DELETE, INSERT statement. @@ -105,9 +97,7 @@ LOCK [ TABLE ] table IN SHARE ROW E - - SHARE MODE - + SHARE MODE @@ -124,9 +114,7 @@ LOCK [ TABLE ] table IN SHARE ROW E - - SHARE ROW EXCLUSIVE MODE - + SHARE ROW EXCLUSIVE MODE @@ -139,9 +127,7 @@ LOCK [ TABLE ] table IN SHARE ROW E - - EXCLUSIVE MODE - + EXCLUSIVE MODE @@ -154,9 +140,7 @@ LOCK [ TABLE ] table IN SHARE ROW E - - ACCESS EXCLUSIVE MODE - + ACCESS EXCLUSIVE MODE @@ -179,7 +163,6 @@ LOCK [ TABLE ] table IN SHARE ROW E - @@ -195,9 +178,20 @@ LOCK [ TABLE ] table IN SHARE ROW E - - ERROR table: Table does not exist. - + +LOCK TABLE + + + + The lock was successfully applied. + + + + + + +ERROR table: Table does not exist. + Message returned if table @@ -328,45 +322,42 @@ LOCK [ TABLE ] table IN SHARE ROW E + Illustrate a SHARE lock on a primary key table when going to perform + inserts into a foreign key table: + - -- - -- SHARE lock primary key table when going to perform - -- insert into foreign key table. - -- - BEGIN WORK; - LOCK TABLE films IN SHARE MODE; - SELECT id FROM films - WHERE name = 'Star Wars: Episode I - The Phantom Menace'; - -- - -- Do ROLLBACK if record was not returned - -- - INSERT INTO films_user_comments VALUES - (_id_, 'GREAT! I was waiting for it for so long!'); - COMMIT WORK; - +BEGIN WORK; +LOCK TABLE films IN SHARE MODE; +SELECT id FROM films + WHERE name = 'Star Wars: Episode I - The Phantom Menace'; +-- Do ROLLBACK if record was not returned +INSERT INTO films_user_comments VALUES + (_id_, 'GREAT! I was waiting for it for so long!'); +COMMIT WORK; + - - -- - -- SHARE ROW EXCLUSIVE lock primary key table when going to perform - -- delete operation. - -- - BEGIN WORK; - LOCK TABLE films IN SHARE ROW EXCLUSIVE MODE; - DELETE FROM films_user_comments WHERE id IN - (SELECT id FROM films WHERE rating < 5); - DELETE FROM films WHERE rating < 5; - COMMIT WORK; - + Take a SHARE ROW EXCLUSIVE lock on a primary key table when going to perform + a delete operation: + + +BEGIN WORK; +LOCK TABLE films IN SHARE ROW EXCLUSIVE MODE; +DELETE FROM films_user_comments WHERE id IN + (SELECT id FROM films WHERE rating < 5); +DELETE FROM films WHERE rating < 5; +COMMIT WORK; + - Compatibility + + @@ -397,7 +388,7 @@ sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../reference.ced" sgml-exposed-tags:nil -sgml-local-catalogs:"/usr/lib/sgml/CATALOG" +sgml-local-catalogs:"/usr/lib/sgml/catalog" sgml-local-ecat-files:nil End: --> diff --git a/doc/src/sgml/ref/move.sgml b/doc/src/sgml/ref/move.sgml index 50dd279062..fdac32aca4 100644 --- a/doc/src/sgml/ref/move.sgml +++ b/doc/src/sgml/ref/move.sgml @@ -1,124 +1,138 @@ - - - + + + + MOVE + + SQL - Language Statements + + + + MOVE + + + Moves cursor position + + + + + 1998-09-24 + + +MOVE [ selector ] [ count ] + { IN | FROM } cursor + FETCH [ RELATIVE ] [ { [ # | ALL | NEXT | PRIOR ] } ] FROM ] cursor + + + + + + 1998-09-24 + + + Description + + + MOVE allows a user to move cursor position a specified + number of rows. + MOVE works like the FETCH command, + but only positions the cursor and does + not return rows. + + + Refer to the FETCH command for details on syntax and usage. + + + + + 1998-09-24 + + + Notes + + + MOVE is a Postgres + language extension. + + + Refer to FETCH for a description + of valid arguments. + Refer to DECLARE to declare a cursor. + Refer to BEGIN WORK, COMMIT WORK, + ROLLBACK WORK statements + for further information about transactions. + + + + + + + Usage + + + Set up and use a cursor: + + +BEGIN WORK; +DECLARE liahona CURSOR FOR SELECT * FROM films; +--Skip first 5 rows: +MOVE FORWARD 5 IN liahona; + MOVE - -SQL - Language Statements - - - -MOVE - - -Moves cursor position - - - - -1998-09-24 - - -MOVE [ selector ] [ count ] - { IN | FROM } cursor -FETCH [ RELATIVE ] [ { [ # | ALL | NEXT | PRIOR ] } ] FROM ] cursor - - + +--Fetch 6th row in the cursor liahona: +FETCH 1 IN liahona; + +FETCH - - - 1998-09-24 - - - Description - - - MOVE allows a user to move cursor position a specified - number of rows. - MOVE works like the FETCH command, - but only positions the cursor and does - not return rows. - - - Refer to the FETCH command for details on syntax and usage. - + code |title |did| date_prod|kind |len + -----+------+---+----------+----------+------ + P_303|48 Hrs|103|1982-10-22|Action | 01:37 + (1 row) + +-- close the cursor liahona and commit work: +CLOSE liahona; +COMMIT WORK; + + + - - - 1998-09-24 - - - Notes - - - MOVE is a Postgres - language extension. - - - Refer to FETCH for a description - of valid arguments. - Refer to DECLARE to declare a cursor. - Refer to BEGIN WORK, COMMIT WORK, - ROLLBACK WORK statements - for further information about transactions. - - - - - - - Usage - - - - --set up and use a cursor: - -- - BEGIN WORK; - DECLARE liahona CURSOR FOR SELECT * FROM films; - - --Skip first 5 rows: - -- - MOVE FORWARD 5 IN liahona; - - MOVE - - --Fetch 6th row in the cursor liahona: - -- - FETCH 1 IN liahona; - - FETCH - code |title |did| date_prod|kind |len - -----+------+---+----------+----------+------ - P_303|48 Hrs|103|1982-10-22|Action | 01:37 - (1 row) - - -- close the cursor liahona and commit work: - -- - CLOSE liahona; - COMMIT WORK; - - - - - - - Compatibility - - - + + + Compatibility + + + - - - 1998-09-01 - - - SQL92 - - - There is no SQL92 MOVE statement. - Instead, SQL92 allows - one to FETCH rows from an absolute cursor position, - implicitly moving the cursor to the correct place. - - - - + + + 1998-09-01 + + + SQL92 + + + There is no SQL92 MOVE statement. + Instead, SQL92 allows + one to FETCH rows from an absolute cursor position, + implicitly moving the cursor to the correct place. + + + + + + diff --git a/doc/src/sgml/ref/notify.sgml b/doc/src/sgml/ref/notify.sgml index f603258ebe..bf35a5c403 100644 --- a/doc/src/sgml/ref/notify.sgml +++ b/doc/src/sgml/ref/notify.sgml @@ -1,237 +1,251 @@ - - - + + + + NOTIFY + + SQL - Language Statements + + + + NOTIFY + + + Signals all frontends and backends listening on a notify condition + + + + + 1998-10-07 + + +NOTIFY name + + + + + 1998-10-07 + + + Inputs + + + + + + notifyname + + + Notify condition to be signaled. + + + + + + + + + + 1998-10-07 + + + Outputs + + + + + + NOTIFY - -SQL - Language Statements - - - -NOTIFY - - -Signals all frontends and backends listening on a notify condition - - - - -1998-10-07 - - - - -NOTIFY notifyname - + + + + Acknowledgement that notify command has executed. + + + + + Notify events + + + Events are delivered to listening frontends; whether and how each frontend + application reacts depends on its programming. + + + + + + + - - - 1998-10-07 - - - Inputs - - + + + 1998-10-07 + + + Description + + + The NOTIFY command sends a notify event to each + frontend application that has previously executed + LISTEN notifyname + for the specified notify condition in the current database. + + + The information passed to the frontend for a notify event includes the notify + condition name and the notifying backend process's PID. It is up to the + database designer to define the condition names that will be used in a given + database and what each one means. + + + Commonly, the notify condition name is the same as the name of some table in + the database, and the notify event essentially means "I changed this table, + take a look at it to see what's new". But no such association is enforced by + the NOTIFY and LISTEN commands. For + example, a database designer could use several different condition names + to signal different sorts of changes to a single table. + + + NOTIFY provides a simple form of signal or + IPC (interprocess communication) mechanism for a collection of processes + accessing the same Postgres database. + Higher-level mechanisms can be built by using tables in the database to + pass additional data (beyond a mere condition name) from notifier to + listener(s). + + + When NOTIFY is used to signal the occurrence of changes + to a particular table, a useful programming technique is to put the + NOTIFY in a rule that is triggered by table updates. + In this way, notification happens automatically when the table is changed, + and the application programmer can't accidentally forget to do it. + + + NOTIFY interacts with SQL transactions in some important + ways. Firstly, if a NOTIFY is executed inside a + transaction, the notify events are not delivered until and unless the + transaction is committed. This is appropriate, since if the transaction + is aborted we would like all the commands within it to have had no + effect, including NOTIFY. But it can be disconcerting if one + is expecting the notify events to be delivered immediately. Secondly, if + a listening backend receives a notify signal while it is within a transaction, + the notify event will not be delivered to its connected frontend until just + after the transaction is completed (either committed or aborted). Again, the + reasoning is that if a notify were delivered within a transaction that was + later aborted, one would want the notification to be undone somehow --- but + the backend cannot "take back" a notify once it has sent it to the frontend. + So notify events are only delivered between transactions. The upshot of this + is that applications using NOTIFY for real-time signaling + should try to keep their transactions short. + + + NOTIFY behaves like Unix signals in one important + respect: if the same condition name is signaled multiple times in quick + succession, recipients may get only one notify event for several executions + of NOTIFY. So it is a bad idea to depend on the number + of notifies received. Instead, use NOTIFY to wake up + applications that need to pay attention to something, and use a database + object (such as a sequence) to keep track of what happened or how many times + it happened. + + + It is common for a frontend that sends NOTIFY to be + listening on the same notify name itself. In that case it will get back a + notify event, just like all the other listening frontends. Depending on the + application logic, this could result in useless work --- for example, + re-reading a database table to find the same updates that that frontend just + wrote out. In Postgres 6.4 and later, it is + possible to avoid such extra work by noticing whether the notifying backend + process's PID (supplied in the notify event message) is the same as one's own + backend's PID (available from libpq). When they are the same, the notify + event is one's own work bouncing back, and can be ignored. (Despite what was + said in the preceding paragraph, this is a safe technique. + Postgres keeps self-notifies separate from notifies + arriving from other backends, so you cannot miss an outside notify by ignoring + your own notifies.) + - - - - notifyname - - - - Notify condition to be signaled. - - - - - - + + + 1998-10-07 + + + Notes + + + name + can be any string valid as a name; + it need not correspond to the name of any actual table. If + name + is enclosed in double-quotes, it need not even be a syntactically + valid name, but can be any string up to 31 characters long. + + + In some previous releases of + Postgres, + name + had to be enclosed in double-quotes when it did not correspond to any existing + table name, even if syntactically valid as a name. That is no longer required. + + + In Postgres releases prior to 6.4, the backend + PID delivered in a notify message was always the PID of the frontend's own + backend. So it was not possible to distinguish one's own notifies from other + clients' notifies in those earlier releases. + + + - - - 1998-10-07 - - - Outputs - - - - - - - NOTIFY - - - - Acknowledgement that notify command has executed. - - - - - - Notify events - - - - Events are delivered to listening frontends; whether and how each frontend - application reacts depends on its programming. - - - - - - - - - - - 1998-10-07 - - - Description - - - The NOTIFY command sends a notify event to each - frontend application that has previously executed - LISTEN notifyname - for the specified notify condition in the current database. - - - The information passed to the frontend for a notify event includes the notify - condition name and the notifying backend process's PID. It is up to the - database designer to define the condition names that will be used in a given - database and what each one means. - - - Commonly, the notify condition name is the same as the name of some table in - the database, and the notify event essentially means "I changed this table, - take a look at it to see what's new". But no such association is enforced by - the NOTIFY and LISTEN commands. For - example, a database designer could use several different condition names - to signal different sorts of changes to a single table. - - - NOTIFY provides a simple form of signal or - IPC (interprocess communication) mechanism for a collection of processes - accessing the same Postgres database. - Higher-level mechanisms can be built by using tables in the database to - pass additional data (beyond a mere condition name) from notifier to - listener(s). - - - When NOTIFY is used to signal the occurrence of changes - to a particular table, a useful programming technique is to put the - NOTIFY in a rule that is triggered by table updates. - In this way, notification happens automatically when the table is changed, - and the application programmer can't accidentally forget to do it. - - - NOTIFY interacts with SQL transactions in some important - ways. Firstly, if a NOTIFY is executed inside a - transaction, the notify events are not delivered until and unless the - transaction is committed. This is appropriate, since if the transaction - is aborted we would like all the commands within it to have had no effect - --- including NOTIFY. But it can be disconcerting if one - is expecting the notify events to be delivered immediately. Secondly, if - a listening backend receives a notify signal while it is within a transaction, - the notify event will not be delivered to its connected frontend until just - after the transaction is completed (either committed or aborted). Again, the - reasoning is that if a notify were delivered within a transaction that was - later aborted, one would want the notification to be undone somehow --- but - the backend cannot "take back" a notify once it has sent it to the frontend. - So notify events are only delivered between transactions. The upshot of this - is that applications using NOTIFY for real-time signaling - should try to keep their transactions short. - - - NOTIFY behaves like Unix signals in one important - respect: if the same condition name is signaled multiple times in quick - succession, recipients may get only one notify event for several executions - of NOTIFY. So it is a bad idea to depend on the number - of notifies received. Instead, use NOTIFY to wake up - applications that need to pay attention to something, and use a database - object (such as a sequence) to keep track of what happened or how many times - it happened. - - - It is common for a frontend that sends NOTIFY to be - listening on the same notify name itself. In that case it will get back a - notify event, just like all the other listening frontends. Depending on the - application logic, this could result in useless work --- for example, - re-reading a database table to find the same updates that that frontend just - wrote out. In Postgres 6.4 and later, it is - possible to avoid such extra work by noticing whether the notifying backend - process's PID (supplied in the notify event message) is the same as one's own - backend's PID (available from libpq). When they are the same, the notify - event is one's own work bouncing back, and can be ignored. (Despite what was - said in the preceding paragraph, this is a safe technique. - Postgres keeps self-notifies separate from notifies - arriving from other backends, so you cannot miss an outside notify by ignoring - your own notifies.) - - - - - 1998-10-07 - - - Notes - - - notifyname - can be any string valid as a name; - it need not correspond to the name of any actual table. If - notifyname - is enclosed in double-quotes, it need not even be a syntactically - valid name, but can be any string up to 31 characters long. - - - In some previous releases of - Postgres, - notifyname - had to be enclosed in double-quotes when it did not correspond to any existing - table name, even if syntactically valid as a name. That is no longer required. - - - In Postgres releases prior to 6.4, the backend - PID delivered in a notify message was always the PID of the frontend's own - backend. So it was not possible to distinguish one's own notifies from other - clients' notifies in those earlier releases. - - - + + + Usage + + + Configure and execute a listen/notify sequence from + psql: - - - Usage - - - - -- Configure and execute a listen/notify sequence from psql - postgres=> listen virtual; - LISTEN - postgres=> notify virtual; - NOTIFY - ASYNC NOTIFY of 'virtual' from backend pid '11239' received - - - + +LISTEN virtual; +NOTIFY virtual; +ASYNC NOTIFY of 'virtual' from backend pid '11239' received + + + - - - Compatibility - - - - - 1998-09-24 - - - SQL92 - - - There is no NOTIFY statement in SQL92. - - - - + + + Compatibility + + + + + + + 1998-09-24 + + + SQL92 + + + There is no NOTIFY statement in + SQL92. + + + + + + diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index e56b573cca..f96d278b4b 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -1,423 +1,396 @@ - - - -pg_dump - -Application - - - -pg_dump - - -Extract a Postgres database into a script file - - - - -1998-11-05 - - + + + + pg_dump + + Application + + + + pg_dump + + + Extract a Postgres database into a script file + + + + + 1998-11-05 + + pg_dump [ dbname ] pg_dump [ -h host ] [ -p port ] - [ -t table ] - [ -f outputfile ] + [ -t table ] [ -f outputfile ] [ -a ] [ -c ] [ -d ] [ -D ] [ -n ] [ -N ] [ -o ] [ -s ] [ -u ] [ -v ] [ -x ] [ dbname ] - + - - - 1998-11-05 - - - Inputs - - - pg_dump accepts the following command line arguments: - - - - - dbname - - - - Specifies the name of the database to be extracted. - dbname - defaults to the value of the - USER - environment variable. - - - - - - - -a - - - - Dump out only the data, no schema (definitions). - - - - - - - -c - - - - Clean(drop) schema prior to create. - - - - - - - -d - - - - Dump data as proper insert strings. - - - - - - - -D - - - - Dump data as inserts with attribute names - - - - - - - -f filename - - - - Specifies the output file. Defaults to stdout. - - - - - - - -n - - - - Suppress double quotes around identifiers unless absolutely necessary. - This may cause trouble loading this dumped data if there are reserved words - used for identifiers. - This was the default behavior in pre-v6.4 pg_dump. - - - - - - - -N - - - - Include double quotes around identifiers. - This is the default. - - - - - - - -o - - - - Dump object identifiers (OIDs) for every table. - - - - - - - -s - - - - Dump out only the schema (definitions), no data. - - - - - - - -t table - - - - Dump data for table only. - - - - - - - -u - - - - Use password authentication. Prompts for username and password. - - - - - - - -v - - - - Specifies verbose mode - - - - - - - -x - - - - Prevent dumping of ACLs (grant/revoke commands) and table ownership information. - - - + + + 1998-11-05 + + + Inputs + + + pg_dump accepts the following command + line arguments: - - - - pg_dump also accepts - the following command line arguments for connection parameters: - - - - - -h host - - - - Specifies the hostname of the machine on which the - postmaster - is running. Defaults to using a local Unix domain socket - rather than an IP connection.. - - - - - - - -p port - - - - Specifies the Internet TCP/IP port or local Unix domain socket file - extension on which the postmaster - is listening for connections. The port number defaults to 5432, - or the value of the PGPORT - environment variable (if set). - - - + + + dbname + + + Specifies the name of the database to be extracted. + dbname + defaults to the value of the + USER + environment variable. + + + - - - -u - - - - Use password authentication. - Prompts for - username - and password. - - - + + -a + + + Dump out only the data, no schema (definitions). + + + - - - + + -c + + + Clean(drop) schema prior to create. + + + - - - 1998-11-05 - - - Outputs - - - pg_dump will create a file or - write to stdout. + + -d + + + Dump data as proper insert strings. + + + - - - - Connection to database 'template1' failed. - connectDB() failed: Is the postmaster running and accepting connections - at 'UNIX Socket' on port 'port'? - - - - pg_dump could not attach to the - postmaster - process on the specified host and port. If you see this message, - ensure that the postmaster - is running on the proper host and that you have specified the proper - port. If your site uses an authentication system, ensure that you - have obtained the required authentication credentials. - - - - - - - Connection to database 'dbname' failed. - FATAL 1: SetUserId: user 'username' is not in 'pg_shadow' - - - - You do not have a valid entry in the relation pg_shadow - and and will not be allowed to access Postgres. - Contact your Postgres administrator. - - - - - - - dumpSequence(table): SELECT failed - - - - You do not have permission to read the database. - Contact your Postgres site administrator. - - - - - - - - - pg_dump internally executes - SELECT statements. If you have problems running - pg_dump, - make sure you are able to select information from the database using, for - example, psql. - - - - - - - - 1998-11-05 - - - Description - - - pg_dump is a utility for dumping out a - Postgres database into a script file - containing query commands. The script - files are in text format and can be used to reconstruct the database, - even on other machines and other architectures. - pg_dump - will produce the queries necessary to re-generate all - user-defined types, functions, tables, indices, aggregates, and - operators. In addition, all the data is copied out in text format so - that it can be readily copied in again, as well as imported into tools - for editing. - + + -D + + + Dump data as inserts with attribute names + + + + + + -f filename + + + Specifies the output file. Defaults to stdout. + + + + + + -n + + + Suppress double quotes around identifiers unless absolutely necessary. + This may cause trouble loading this dumped data if there are reserved words + used for identifiers. + This was the default behavior in pre-v6.4 pg_dump. + + + + + + -N + + + Include double quotes around identifiers. + This is the default. + + + + + + -o + + + Dump object identifiers (OIDs) for every table. + + + + + + -s + + + Dump out only the schema (definitions), no data. + + + + + + -t table + + + Dump data for table only. + + + + + + -u + + + Use password authentication. Prompts for username and password. + + + + + + -v + + + Specifies verbose mode + + + + + + -x + + + Prevent dumping of ACLs (grant/revoke commands) and table ownership information. + + + + + + + + pg_dump also accepts + the following command line arguments for connection parameters: + + + + -h host + + + Specifies the hostname of the machine on which the + postmaster + is running. Defaults to using a local Unix domain socket + rather than an IP connection.. + + + + + + -p port + + + Specifies the Internet TCP/IP port or local Unix domain socket file + extension on which the postmaster + is listening for connections. The port number defaults to 5432, + or the value of the PGPORT + environment variable (if set). + + + + + + -u + + + Use password authentication. + Prompts for + username + and password. + + + + + + + + + + 1998-11-05 + + + Outputs + + + pg_dump will create a file or + write to stdout. + + + + +Connection to database 'template1' failed. +connectDB() failed: Is the postmaster running and accepting connections + at 'UNIX Socket' on port 'port'? + + + + pg_dump could not attach to the + postmaster + process on the specified host and port. If you see this message, + ensure that the postmaster + is running on the proper host and that you have specified the proper + port. If your site uses an authentication system, ensure that you + have obtained the required authentication credentials. + + + + + + +Connection to database 'dbname' failed. +FATAL 1: SetUserId: user 'username' is not in 'pg_shadow' + + + + You do not have a valid entry in the relation pg_shadow + and and will not be allowed to access Postgres. + Contact your Postgres administrator. + + + + + + +dumpSequence(table): SELECT failed + + + + You do not have permission to read the database. + Contact your Postgres site administrator. + + + + + + + + pg_dump internally executes + SELECT statements. If you have problems running + pg_dump, + make sure you are able to select information from the database using, for + example, psql. + + + + + + + + 1998-11-05 + + + Description + + + pg_dump is a utility for dumping out a + Postgres database into a script file + containing query commands. The script + files are in text format and can be used to reconstruct the database, + even on other machines and other architectures. + pg_dump + will produce the queries necessary to re-generate all + user-defined types, functions, tables, indices, aggregates, and + operators. In addition, all the data is copied out in text format so + that it can be readily copied in again, as well as imported into tools + for editing. + + + + pg_dump + is useful for dumping out the contents of a database to move from one + Postgres installation to another. After running + pg_dump, + one should examine the output script file for any warnings, especially + in light of the limitations listed below. + + + + + + 1998-11-05 + + + Notes + + + pg_dump has a few limitations. + The limitations mostly stem from + difficulty in extracting certain meta-information from the system + catalogs. + + + + pg_dump - is useful for dumping out the contents of a database to move from one - Postgres installation to another. After running - pg_dump, - one should examine the output script file for any warnings, especially - in light of the limitations listed below. - - + does not understand partial indices. The reason is + the same as above; partial index predicates are stored as plans. + + - - - 1998-11-05 - - - Notes - - - pg_dump has a few limitations. - The limitations mostly stem from - difficulty in extracting certain meta-information from the system - catalogs. + + + pg_dump does not handle large objects. + Large objects are ignored and must be dealt with manually. + + + + + - - - - partial indices - - - - pg_dump - does not understand partial indices. The reason is - the same as above; partial index predicates are stored as plans. - - - + + + 1998-11-05 + + + Usage + + + To dump a database of the same name as the user: - - - large objects - - - - pg_dump does not handle large objects. - Large objects are ignored and must be dealt with manually. - - - - - - - + +% pg_dump > db.out + + - - - 1998-11-05 - - - Usage - - - To dump a database of the same name as the user: + + To reload this database: - - % pg_dump > db.out - - - - To reload this database: - - - psql -e database < db.out - - - - + +% psql -e database < db.out + + + + + + diff --git a/doc/src/sgml/ref/pg_dumpall.sgml b/doc/src/sgml/ref/pg_dumpall.sgml index 9447ff8942..f06d430e69 100644 --- a/doc/src/sgml/ref/pg_dumpall.sgml +++ b/doc/src/sgml/ref/pg_dumpall.sgml @@ -1,323 +1,316 @@ - - - -pg_dumpall - -Application - - - -pg_dumpall - - -Extract all Postgres databases into a script file - - - - -1998-10-04 - - + + + + pg_dumpall + + Application + + + + pg_dumpall + + + Extract all Postgres databases into a script file + + + + + 1998-10-04 + + pg_dumpall -pg_dumpall [ -h host ] [ -p port ] - [ -a ] [ -d ] [ -D ] [ -o ] [ -s ] [ -u ] [ -v ] [ -x ] - +pg_dumpall [ -h host ] [ -p port ] [ -a ] [ -d ] [ -D ] [ -o ] [ -s ] [ -u ] [ -v ] [ -x ] + - - - 1998-10-04 - - - Inputs - - - pg_dumpall accepts the following command line arguments: - - - - - -a - - - - Dump out only the data, no schema (definitions). - - - - - - -d - - - - Dump data as proper insert strings. - - - - - - - -D - - - - Dump data as inserts with attribute names - - - - - - - -n - - - - Suppress double quotes around identifiers unless absolutely necessary. - This may cause trouble loading this dumped data if there are reserved words - used for identifiers. - - - - - - - -o - - - - Dump object identifiers (OIDs) for every table. - - - - - - - -s - - - - Dump out only the schema (definitions), no data. - - - + + + 1998-10-04 + + + Inputs + + + pg_dumpall accepts the following command line arguments: - - - -u - - - - Use password authentication. Prompts for username and password. - - - - - - - -v - - - - Specifies verbose mode - - - - - - - -x - - - - Prevent dumping ACLs (grant/revoke commands) and table ownership information. - - - - - - - - pg_dumpall also accepts - the following command line arguments for connection parameters: - - - - - -h host - - - - Specifies the hostname of the machine on which the - postmaster - is running. Defaults to using a local Unix domain socket - rather than an IP connection.. - - - - - - - -p port - - - - Specifies the Internet TCP/IP port or local Unix domain socket file - extension on which the postmaster - is listening for connections. The port number defaults to 5432, - or the value of the PGPORT - environment variable (if set). - - - - - - - -u - - - - Use password authentication. - Prompts for - username - and password. - - - - - - + + + -a + + + Dump out only the data, no schema (definitions). + + + - - - 1998-10-04 - - - Outputs - - - pg_dumpall will create a file or - write to stdout. - - - - - Connection to database 'template1' failed. - connectDB() failed: Is the postmaster running and accepting connections - at 'UNIX Socket' on port 'port'? - - - - pg_dumpall could not attach to the - postmaster - process on the specified host and port. If you see this message, - ensure that the postmaster - is running on the proper host and that you have specified the proper - port. If your site uses an authentication system, ensure that you - have obtained the required authentication credentials. - - - - - - - Connection to database 'dbname' failed. - FATAL 1: SetUserId: user 'username' is not in 'pg_shadow' - - - - You do not have a valid entry in the relation pg_shadow - and and will not be allowed to access Postgres. - Contact your Postgres administrator. - - - + + -d + + + Dump data as proper insert strings. + + + - - - dumpSequence(table): SELECT failed - - - - You do not have permission to read the database. - Contact your Postgres site administrator. - - - - - + + -D + + + Dump data as inserts with attribute names + + + - - - pg_dumpall internally executes - SELECT statements. If you have problems running - pg_dumpall, - make sure you are able to select information from the database using, for - example, psql. - - - - - - - - 1998-10-04 - - - Description - - - pg_dumpall - is a utility for dumping out all Postgres databases into one file. - It also dumps the pg_shadow table, which is global to all databases. - pg_dumpall includes in this file the proper commands - to automatically create each dumped database before loading. - + + -n + + + Suppress double quotes around identifiers unless absolutely necessary. + This may cause trouble loading this dumped data if there are reserved words + used for identifiers. + + + + + + -o + + + Dump object identifiers (OIDs) for every table. + + + + + + -s + + + Dump out only the schema (definitions), no data. + + + + + + -u + + + Use password authentication. Prompts for username and password. + + + + + + -v + + + Specifies verbose mode + + + + + + -x + + + Prevent dumping ACLs (grant/revoke commands) and table ownership information. + + + + + + + + + pg_dumpall also accepts + the following command line arguments for connection parameters: + + + + -h host + + + Specifies the hostname of the machine on which the + postmaster + is running. Defaults to using a local Unix domain socket + rather than an IP connection.. + + + + + + -p port + + + Specifies the Internet TCP/IP port or local Unix domain socket file + extension on which the postmaster + is listening for connections. The port number defaults to 5432, + or the value of the PGPORT + environment variable (if set). + + + + + + -u + + + Use password authentication. + Prompts for + username + and password. + + + + + + + + + + 1998-10-04 + + + Outputs + + + pg_dumpall will create a file or + write to stdout. + + + + +Connection to database 'template1' failed. +connectDB() failed: Is the postmaster running and accepting connections at 'UNIX Socket' on port 'port'? + + + + pg_dumpall could not attach to the + postmaster + process on the specified host and port. If you see this message, + ensure that the postmaster + is running on the proper host and that you have specified the proper + port. If your site uses an authentication system, ensure that you + have obtained the required authentication credentials. + + + + + + +Connection to database 'dbname' failed. +FATAL 1: SetUserId: user 'username' is not in 'pg_shadow' + + + + You do not have a valid entry in the relation pg_shadow + and and will not be allowed to access Postgres. + Contact your Postgres administrator. + + + + + + +dumpSequence(table): SELECT failed + + + + You do not have permission to read the database. + Contact your Postgres site administrator. + + + + + + + - pg_dumpall takes all pg_dump - options, but , and - dbname - should be omitted. + pg_dumpall internally executes + SELECT statements. If you have problems running + pg_dumpall, + make sure you are able to select information from the database using, for + example, psql. + + + + + + + 1998-10-04 + + + Description + + + pg_dumpall + is a utility for dumping out all Postgres databases into one file. + It also dumps the pg_shadow table, which is global to all databases. + pg_dumpall includes in this file the proper commands + to automatically create each dumped database before loading. + + + pg_dumpall takes all pg_dump + options, but , and + dbname + should be omitted. + + + Refer to + + for more information on this capability. + + + + + + 1998-10-04 + + + Usage + + + To dump all databases: + + +% pg_dumpall -o > db.out + + + - Refer to - - for more information on this capability. - - - - - 1998-10-04 - - - Usage - - - To dump all databases: - - - % pg_dumpall -o > db.out - - - - - You can use most pg_dump options - for pg_dumpall. - - + You can use most pg_dump options + for pg_dumpall. - - To reload this database: - - - psql -e template1 < db.out - - - - - You can use most psql options - when reloading. - - - - + + + + To reload this database: + + +% psql -e template1 < db.out + + + + + You can use most psql options + when reloading. + + + + + + diff --git a/doc/src/sgml/ref/pg_upgrade.sgml b/doc/src/sgml/ref/pg_upgrade.sgml index 7ee84fa0d3..46ad32c7a9 100644 --- a/doc/src/sgml/ref/pg_upgrade.sgml +++ b/doc/src/sgml/ref/pg_upgrade.sgml @@ -1,59 +1,128 @@ - - - -pg_upgrade - -Application - - - -pg_upgrade - - -Allows upgrade from a previous release without reloading data - - - -1998-10-04 - - + + + + pg_upgrade + + Application + + + + pg_upgrade + + + Allows upgrade from a previous release without reloading data + + + + 1998-10-04 + + pg_upgrade -pg_upgrade [-f input_file] old_data_dir - +pg_upgrade [ -f filename ] old_data_dir + + - - -1998-10-04 - - -Description - - -pg_upgrade - is a utility for upgrading from a previous - PostgreSQL release without reloading all the data. First, - to be safe, back up your data directory. Then, use: - + + + 1998-10-04 + + + Description + + + pg_upgrade + is a utility for upgrading from a previous + PostgreSQL release without reloading all the data. + + + Upgrading <productname>Postgres</productname> + + + + Back up your data directory. + + + + + + Use: + % pg_dumpall -s >db.out - -to dump out your old database definitions without any -data. Stop the postmaster and all backends. - + + to dump out your old database definitions without any + data. Stop the postmaster and all backends. + + - -Then rename (using mv) your old pgsql /data directory to -/data.old and do a make install to install the new binaries. -Run initdb to create a new template1 database containing the system -tables for the new release. Start the new postmaster, cd to the -pgsql main directory, and type: - + + + Rename (using mv) your old pgsql data/ directory to + data.old/. + + + + + + Do a + make install to install the new binaries. + + + + + + Run initdb to create a new template1 database containing the system + tables for the new release. + + + + + + Start the new postmaster. + + + + + + Change your working directory to the + pgsql main directory, and type: + % pg_upgrade -f db.out data.old - -The system will do some checking to make sure everything -is properly configured, and run your db.out script to create -all the databases and tables you had, but with no -data. It will then move the data files from /data.old -into the proper /data directory. You can then check out -the data. You can delete the /data.old directory when you -are finished. - + + The system will do some checking to make sure everything + is properly configured, and will run your db.out script to create + all the databases and tables you had, but with no + data. It will then move the data files from data.old/ + into the proper data/ directory. + + + + + + Carefully examine the contents of the upgraded database. + + + + + + You can delete the data.old/ directory when you + are finished. + + + + + diff --git a/doc/src/sgml/ref/pgaccess-ref.sgml b/doc/src/sgml/ref/pgaccess-ref.sgml index ec9b9a1b65..2f7b94d8f2 100644 --- a/doc/src/sgml/ref/pgaccess-ref.sgml +++ b/doc/src/sgml/ref/pgaccess-ref.sgml @@ -1,57 +1,74 @@ - - - + + + pgaccess - - Application - - - + + Application + + + pgaccess - - + + Postgres graphical interactive client - + - - - 1999-05-19 - - + + + 1999-05-19 + + pgaccess [ dbname ] - + - - - 1999-05-19 - - + <refsect2 id="R2-APP-PGACCESS-1"> + <refsect2info> + <date>1999-05-19</date> + </refsect2info> + <title> Inputs - - + + + + + + dbname + + + The name of an existing database to access. + + + + - - - 1999-05-19 - - + <refsect2 id="R2-APP-PGACCESS-2"> + <refsect2info> + <date>1999-05-19</date> + </refsect2info> + <title> Outputs - - + + - - - 1999-05-19 - - + <refsect1 id="R1-APP-PGACCESS-1"> + <refsect1info> + <date>1999-05-19</date> + </refsect1info> + <title> Description - - + + + + Editor's Note + + This should be transcribed from other pgaccess info. Volunteers? + + @@ -68,7 +85,7 @@ sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../reference.ced" sgml-exposed-tags:nil -sgml-local-catalogs:"/usr/lib/sgml/CATALOG" +sgml-local-catalogs:"/usr/lib/sgml/catalog" sgml-local-ecat-files:nil End: --> diff --git a/doc/src/sgml/ref/pgadmin-ref.sgml b/doc/src/sgml/ref/pgadmin-ref.sgml index 476923a455..b605505d61 100644 --- a/doc/src/sgml/ref/pgadmin-ref.sgml +++ b/doc/src/sgml/ref/pgadmin-ref.sgml @@ -1,57 +1,74 @@ - - - + + + pgadmin - - Application - - - + + Application + + + pgadmin - - + + Postgres graphical interactive client - + - - - 1999-05-19 - - + + + 1999-05-19 + + pgadmin [ dbname ] - + - - - 1999-05-19 - - + <refsect2 id="R2-APP-PGADMIN-1"> + <refsect2info> + <date>1999-05-19</date> + </refsect2info> + <title> Inputs - - + + + + + + dbname + + + The name of an existing database to access. + + + + - - - 1999-05-19 - - + <refsect2 id="R2-APP-PGADMIN-2"> + <refsect2info> + <date>1999-05-19</date> + </refsect2info> + <title> Outputs - - + + - - - 1999-05-19 - - + <refsect1 id="R1-APP-PGADMIN-1"> + <refsect1info> + <date>1999-05-19</date> + </refsect1info> + <title> Description - - + + + + Editor's Note + + This should be transcribed from other pgadmin info. Volunteers? + + @@ -68,7 +85,7 @@ sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../reference.ced" sgml-exposed-tags:nil -sgml-local-catalogs:"/usr/lib/sgml/CATALOG" +sgml-local-catalogs:"/usr/lib/sgml/catalog" sgml-local-ecat-files:nil End: --> diff --git a/doc/src/sgml/ref/postgres-ref.sgml b/doc/src/sgml/ref/postgres-ref.sgml index 2a14bcb98c..57775152f8 100644 --- a/doc/src/sgml/ref/postgres-ref.sgml +++ b/doc/src/sgml/ref/postgres-ref.sgml @@ -36,9 +36,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - dbname - + dbname The optional argument @@ -53,9 +51,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -B nBuffers - + -B nBuffers If the backend is running under the @@ -72,9 +68,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -C - + -C Do not show the server version number. @@ -83,9 +77,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -D DataDir - + -D DataDir Specifies the directory to use as the root of the tree of database @@ -102,9 +94,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -E - + -E Echo all queries. @@ -113,9 +103,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -F - + -F Disable an automatic fsync() call after each transaction. @@ -128,9 +116,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -O - + -O Override restrictions, so system table structures can be modified. @@ -140,9 +126,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -Q - + -Q Specifies "quiet" mode. @@ -151,9 +135,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -S SortSize - + -S SortSize Specifies the amount of memory to be used by internal sorts and hashes @@ -168,9 +150,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -d [ DebugLevel ] - + -d [ DebugLevel ] The optional argument DebugLevel @@ -191,9 +171,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -e - + -e This option controls how dates are interpreted upon @@ -214,9 +192,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -o OutputFile - + -o OutputFile Sends all debugging and error output to @@ -232,9 +208,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -s - + -s Print time information and other statistics at the end of each query. @@ -245,9 +219,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -v protocol - + -v protocol Specifies the number of the frontend/backend protocol to be used for this @@ -271,9 +243,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -A n|r|b|Q\fIn\fP|X\fIn\fP - + -A n|r|b|Q\fIn\fP|X\fIn\fP This option generates a tremendous amount of output. @@ -282,9 +252,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -L - + -L Turns off the locking system. @@ -293,9 +261,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -N - + -N Disables use of newline as a query delimiter. @@ -304,9 +270,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -f [ s | i | m | n | h ] - + -f [ s | i | m | n | h ] Forbids the use of particular scan and join methods: @@ -328,9 +292,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -i - + -i Prevents query execution, but shows the plan tree. @@ -339,9 +301,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -p dbname - + -p dbname Indicates to the backend server that it has been started by a @@ -354,9 +314,7 @@ postgres [ -B nBuffers ] [ -C ] [ - - - -t pa[rser] | pl[anner] | e[xecutor] - + -t pa[rser] | pl[anner] | e[xecutor] Print timing statistics for each query relating to each of the major @@ -381,9 +339,9 @@ postgres [ -B nBuffers ] [ -C ] [ - - - semget: No space left on device - + +semget: No space left on device + If you see this message, you should run the diff --git a/doc/src/sgml/ref/postmaster.sgml b/doc/src/sgml/ref/postmaster.sgml index 3d628f5311..33081915f2 100644 --- a/doc/src/sgml/ref/postmaster.sgml +++ b/doc/src/sgml/ref/postmaster.sgml @@ -36,9 +36,7 @@ postmaster [ -n | -s ] ... - - -B nBuffers - + -B nBuffers The number of shared-memory buffers for the @@ -51,9 +49,7 @@ postmaster [ -n | -s ] ... - - -D DataDir - + -D DataDir Specifies the directory to use as the root of the tree of database @@ -70,9 +66,7 @@ postmaster [ -n | -s ] ... - - -N nBackends - + -N nBackends The maximum number of backend server processes that this postmaster @@ -86,9 +80,7 @@ postmaster [ -n | -s ] ... - - -S - + -S Specifies that the postmaster @@ -102,9 +94,7 @@ postmaster [ -n | -s ] ... - - -d [ DebugLevel ] - + -d [ DebugLevel ] The optional argument DebugLevel @@ -125,9 +115,7 @@ postmaster [ -n | -s ] ... - - -i - + -i This enables TCP/IP or Internet domain socket communication. @@ -138,9 +126,7 @@ postmaster [ -n | -s ] ... - - -o BackendOptions - + -o BackendOptions The @@ -156,9 +142,7 @@ postmaster [ -n | -s ] ... - - -p port - + -p port Specifies the TCP/IP port or local Unix domain socket file extension @@ -200,9 +184,7 @@ postmaster [ -n | -s ] ... - - -n - + -n postmaster @@ -215,9 +197,7 @@ postmaster [ -n | -s ] ... - - -s - + -s postmaster @@ -259,9 +239,9 @@ postmaster [ -n | -s ] ... --> - - semget: No space left on device - + +semget: No space left on device + If you see this message, you should run the @@ -290,9 +270,9 @@ postmaster [ -n | -s ] ... - - StreamServerPort: cannot bind to port - + +StreamServerPort: cannot bind to port + If you see this message, you should be certain that there is no other @@ -330,9 +310,9 @@ on BSD-based systems, or - - IpcMemoryAttach: shmat() failed: Permission denied - + +IpcMemoryAttach: shmat() failed: Permission denied + A likely explanation is that another user attempted to start a diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index cb58dd0894..22c3f96fb0 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -20,11 +20,9 @@ psql [ dbname ] psql -A [ -c query ] [ -d dbname ] - -e -E [ -f filename ] - [ -F separator ] [ -h hostname ] - -Hln [ -o filename ] [ -p -port ] - -qsSt [ -T table_o ] -ux + -e -E [ -f filename ] [ -F separator ] + [ -h hostname ] -Hln [ -o filename ] + [ -p port ] -qsSt [ -T table_o ] -ux [ dbname ] @@ -43,9 +41,7 @@ psql -A [ -c query ] [ -d - - dbname - + dbname The name of an existing database to access. @@ -59,22 +55,21 @@ psql -A [ -c query ] [ -d - - -c query - + -c query A single query to run. psql will exit on completion. - + The full set of command-line arguments and meta-commands are described in a subsequent section. + There are some environment variables which can be used in liu of command line arguments. @@ -91,9 +86,7 @@ psql -A [ -c query ] [ -d - - PGHOST - + PGHOST The DNS host name of the database server. @@ -105,9 +98,7 @@ psql -A [ -c query ] [ -d - - PGPORT - + PGPORT The port number on which a Postgres server is listening. @@ -117,9 +108,7 @@ psql -A [ -c query ] [ -d - - PGTTY - + PGTTY The target for display of messages from the client support library. @@ -129,9 +118,7 @@ psql -A [ -c query ] [ -d - - PGOPTION - + PGOPTION If PGOPTION @@ -143,9 +130,7 @@ psql -A [ -c query ] [ -d - - PGREALM - + PGREALM PGREALM @@ -176,11 +161,13 @@ psql -A [ -c query ] [ -d psql returns 0 to the shell on successful completion of all queries, 1 for errors, 2 for abrupt disconnection from the backend. - The default TAB delimiter is used. psql will also return 1 if the connection to a database could not be made for any reason. + + The default TAB delimiter is used. + @@ -337,9 +324,7 @@ testdb=> - - -A - + -A Turn off fill justification when printing out table elements. @@ -348,9 +333,7 @@ testdb=> - - -c query - + -c query Specifies that @@ -364,9 +347,7 @@ testdb=> - - -d dbname - + -d dbname Specifies the name of the database to connect to. This is equivalent to specifying @@ -377,9 +358,7 @@ testdb=> - - -e - + -e Echo the query sent to the backend @@ -388,9 +367,7 @@ testdb=> - - -E - + -E Echo the actual query generated by \d and other backslash commands @@ -399,9 +376,7 @@ testdb=> - - -f filename - + -f filename Use the file filename @@ -412,9 +387,7 @@ testdb=> - - -F separator - + -F separator Use separator @@ -425,9 +398,7 @@ testdb=> - - -h hostname - + -h hostname Specifies the host name of the machine on which the @@ -440,9 +411,7 @@ testdb=> - - -H - + -H Turns on @@ -453,9 +422,7 @@ testdb=> - - -l - + -l Lists all available databases, then exit. Other non-connection options are ignored. @@ -464,9 +431,7 @@ testdb=> - - -n - + -n Do not use the readline library for input line editing and command history. @@ -475,9 +440,7 @@ testdb=> - - -o filename - + -o filename Put all output into file filename. @@ -487,9 +450,7 @@ testdb=> - - -p port - + -p port Specifies the TCP/IP port or, by omission, the local Unix domain socket file @@ -503,9 +464,7 @@ testdb=> - - -q - + -q Specifies that @@ -520,9 +479,7 @@ testdb=> - - -s - + -s Run in single-step mode where the user is prompted for each query before @@ -532,9 +489,7 @@ testdb=> - - -S - + -S Runs in single-line mode where each query is terminated by a newline, @@ -544,9 +499,7 @@ testdb=> - - -t - + -t Turn off printing of column names. @@ -558,9 +511,7 @@ testdb=> - - -T table_options - + -T table_options Allows you to specify options to be placed within the @@ -573,9 +524,7 @@ testdb=> - - -u - + -u Asks the user for the user name and password before connecting to the database. @@ -588,9 +537,7 @@ testdb=> - - -x - + -x Turns on extended row format mode. When enabled each row will have its column @@ -640,9 +587,7 @@ testdb=> - - \a - + \a Toggle field alignment when printing out table elements. @@ -651,9 +596,7 @@ testdb=> - - \C caption - + \C caption Set the HTML3.0 table caption to @@ -663,10 +606,7 @@ testdb=> - - \connect meter"ceable> [ username ] - + \connect meter"ceable> [ username ] Establish a connection to a new database, using the default @@ -677,9 +617,7 @@ testdb=> - - \copy meter"ceable> { FROM | TO } - filename + \copy meter"ceable> { FROM | TO } filename @@ -703,9 +641,7 @@ testdb=> - - \d [ table ] - + \d [ table ] List tables in the database, or if - - \da - + \da List all available aggregates. @@ -729,9 +663,7 @@ testdb=> - - \dd object - + \dd object List the description from pg_description @@ -749,9 +681,7 @@ testdb=> - - \df - + \df List functions. @@ -760,9 +690,7 @@ testdb=> - - \di - + \di List only indexes. @@ -771,9 +699,7 @@ testdb=> - - \do - + \do List only operators. @@ -782,9 +708,7 @@ testdb=> - - \ds - + \ds List only sequences. @@ -793,9 +717,7 @@ testdb=> - - \dS - + \dS List system tables and indexes. @@ -804,9 +726,7 @@ testdb=> - - \dt - + \dt List only non-system tables. @@ -815,9 +735,7 @@ testdb=> - - \dT - + \dT List types. @@ -825,10 +743,8 @@ testdb=> - - - \e [ filename ] - + + \e [ filename ] Edit the current query buffer or the contents of the file @@ -838,9 +754,7 @@ testdb=> - - \E [ filename ] - + \E [ filename ] Edit the current query buffer or the contents of the file @@ -851,9 +765,7 @@ testdb=> - - \f [ separator ] - + \f [ separator ] Set the field separator. Default is a single blank space. @@ -862,9 +774,7 @@ testdb=> - - \g [ { filename | |command } ] - + \g [ { filename | |command } ] Send the current query input buffer to the backend and optionally @@ -876,9 +786,7 @@ testdb=> - - \h [ command ] - + \h [ command ] Give syntax help on the specified SQL command. @@ -895,9 +803,7 @@ testdb=> - - \H - + \H Toggle HTML3 output. This is equivalent to @@ -908,9 +814,7 @@ testdb=> - - \i filename - + \i filename Read queries from the file filename @@ -920,9 +824,7 @@ testdb=> - - \l - + \l List all the databases in the server. @@ -931,9 +833,7 @@ testdb=> - - \m - + \m Toggle the old monitor-like table display, which includes border characters @@ -946,9 +846,7 @@ testdb=> - - \o [ { filename | |command } ] - + \o [ { filename | |command } ] Save future query results to the file @@ -962,9 +860,7 @@ testdb=> - - \p - + \p Print the current query buffer. @@ -973,9 +869,7 @@ testdb=> - - \q - + \q Quit the psql program. @@ -984,9 +878,7 @@ testdb=> - - \r - + \r Reset(clear) the query buffer. @@ -995,9 +887,7 @@ testdb=> - - \s [ filename ] - + \s [ filename ] Print or save the command line history to @@ -1011,9 +901,7 @@ testdb=> - - \t - + \t Toggle display of output column name headings and row count footer (defaults to on). @@ -1022,9 +910,7 @@ testdb=> - - \T table_options - + \T table_options Allows you to specify options to be placed within the @@ -1038,9 +924,7 @@ testdb=> - - \x - + \x Toggles extended row format mode. When enabled each row will have its column @@ -1052,9 +936,7 @@ testdb=> - - \w filename - + \w filename Outputs the current query buffer to the file @@ -1064,9 +946,7 @@ testdb=> - - \z - + \z Produces a list of all tables in the database with their appropriate ACLs @@ -1076,9 +956,7 @@ testdb=> - - \! [ command ] - + \! [ command ] Escape to a separate Unix shell or execute the Unix command @@ -1088,9 +966,7 @@ testdb=> - - \? - + \? Get help information about the slash (\) commands. @@ -1114,7 +990,7 @@ sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../reference.ced" sgml-exposed-tags:nil -sgml-local-catalogs:"/usr/lib/sgml/CATALOG" +sgml-local-catalogs:"/usr/lib/sgml/catalog" sgml-local-ecat-files:nil End: --> diff --git a/doc/src/sgml/ref/reset.sgml b/doc/src/sgml/ref/reset.sgml index a778a11658..9b1452816b 100644 --- a/doc/src/sgml/ref/reset.sgml +++ b/doc/src/sgml/ref/reset.sgml @@ -31,9 +31,7 @@ RESET variable - - variable - + variable Refer to the SET statement for more information on available @@ -56,9 +54,9 @@ RESET variable - - RESET VARIABLE - + +RESET VARIABLE + Message returned if @@ -110,12 +108,17 @@ RESET variable Usage + Set DateStyle to its default value: + --- reset DateStyle to its default; RESET DateStyle; + + + + Set Geqo to its default value: + --- reset Geqo to its default; RESET GEQO; diff --git a/doc/src/sgml/ref/revoke.sgml b/doc/src/sgml/ref/revoke.sgml index ad6184cca7..c267651a65 100644 --- a/doc/src/sgml/ref/revoke.sgml +++ b/doc/src/sgml/ref/revoke.sgml @@ -34,93 +34,80 @@ REVOKE privilege [, ...] - - privilege - + privilege The possible privileges are: + + + + SELECT + + + Privilege to access all of the columns of a specific + table/view. + + + + + + INSERT + + + Privilege to insert data into all columns of a + specific table. + + + + + + UPDATE + + + Privilege to update all columns of a specific + table. + + + + + + DELETE + + + Privilege to delete rows from a specific table. + + + + + + RULE + + + Privilege to define rules on table/view. + (See CREATE RULE). + + + + + + ALL + + + Rescind all privileges. + + + + - - SELECT - - - - Privilege to access all of the columns of a specific - table/view. - - - - - - - INSERT - - - - Privilege to insert data into all columns of a - specific table. - - - - - - - UPDATE - - - - Privilege to update all columns of a specific - table. - - - - - - - DELETE - - - - Privilege to delete rows from a specific table. - - - - - - - RULE - - - - Privilege to define rules on table/view. - (See CREATE RULE). - - - - - - - ALL - - - - Rescind all privileges. - - - - - - - object - + object The name of an object from which to revoke access. + The possible objects are: @@ -152,9 +139,7 @@ REVOKE privilege [, ...] - - group - + group The name of a group from whom to revoke privileges. @@ -163,9 +148,7 @@ REVOKE privilege [, ...] - - username - + username The name of a user from whom revoke privileges. Use the PUBLIC keyword @@ -175,9 +158,7 @@ REVOKE privilege [, ...] - - PUBLIC - + PUBLIC Rescind the specified privilege(s) for all users. @@ -199,9 +180,9 @@ REVOKE privilege [, ...] - - CHANGE - + +CHANGE + Message returned if successfully. @@ -210,9 +191,9 @@ REVOKE privilege [, ...] - - ERROR - + +ERROR + Message returned if object is not available or impossible @@ -233,7 +214,7 @@ REVOKE privilege [, ...] Description - REVOKE allows creator of an object to revoke permissions granted + REVOKE allows creator of an object to revoke permissions granted before, from all users (via PUBLIC) or a certain user or group. @@ -271,7 +252,8 @@ Legend: Currently, to create a GROUP you have to insert data manually into table pg_group as: - + + INSERT INTO pg_group VALUES ('todos'); CREATE USER miriam IN GROUP todos; @@ -286,15 +268,18 @@ CREATE USER miriam IN GROUP todos; Usage + Revoke insert privilege from all users on table + films: + --- revoke insert privilege from all users on table films: --- REVOKE INSERT ON films FROM PUBLIC; + + + + Revoke all privileges from user manuel on view kinds: --- revoke all privileges from user manuel on view kinds: --- REVOKE ALL ON kinds FROM manuel; @@ -355,6 +340,7 @@ REVOKE GRANT OPTION FOR privilege [ + The possible objects are: @@ -381,6 +367,7 @@ REVOKE GRANT OPTION FOR privilege [ and user2 gives it to user3 then user1 can revoke this privilege in cascade using the CASCADE keyword. + If user1 gives a privilege WITH GRANT OPTION to user2, and user2 gives it to user3 then if user1 try revoke diff --git a/doc/src/sgml/ref/rollback.sgml b/doc/src/sgml/ref/rollback.sgml index 01c095736d..2ad271e246 100644 --- a/doc/src/sgml/ref/rollback.sgml +++ b/doc/src/sgml/ref/rollback.sgml @@ -1,13 +1,13 @@ -ROLLBACK + ROLLBACK SQL - Language Statements -ROLLBACK + ROLLBACK Aborts the current transaction @@ -44,9 +44,9 @@ ROLLBACK [ WORK | TRANSACTION ] - - ABORT - + +ABORT + Message returned if successful. @@ -55,10 +55,10 @@ ROLLBACK [ WORK | TRANSACTION ] - - NOTICE: UserAbortTransactionBlock and not in in-progress state - ABORT - + +NOTICE: UserAbortTransactionBlock and not in in-progress state +ABORT + If there is not any transaction currently in progress. @@ -106,10 +106,10 @@ ROLLBACK [ WORK | TRANSACTION ] Usage + To abort all changes: + - --To abort all changes: - -- - ROLLBACK WORK; +ROLLBACK WORK; @@ -129,7 +129,7 @@ ROLLBACK [ WORK | TRANSACTION ] SQL92 - Full compatibility. TRANSACTION is a + Full compatibility. The TRANSACTION keyword is a Postgres extension.