From: Thomas G. Lockhart Date: Wed, 21 Oct 1998 05:34:12 +0000 (+0000) Subject: Minor fixes in markup. X-Git-Tag: REL6_4_2~171 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0958666ce661d33362f4b7f318b6aef64a39697f;p=postgresql Minor fixes in markup. Include cross-references in NOTIFY and UNLISTEN. --- diff --git a/doc/src/sgml/ref/create_sequence.sgml b/doc/src/sgml/ref/create_sequence.sgml index 2ba60a56d4..63644c88ff 100644 --- a/doc/src/sgml/ref/create_sequence.sgml +++ b/doc/src/sgml/ref/create_sequence.sgml @@ -234,10 +234,16 @@ CREATE SEQUENCE seqname to get a new number from the sequence. The function currval('seqname') - may be used - to determine the number returned by the last call to + may be used to determine the number returned by the last call to nextval(seqname) for the specified sequence in the current session. +The function +setval('seqname', + newvalue) +may be used to set the current value of the specified sequence. +The next call to +nextval(seqname) +will return the given value plus the sequence increment. @@ -259,10 +265,8 @@ SELECT last_value FROM sequence_name; calls to a generator. - - - NOTE: - + + Unexpected results may be obtained if a cache setting greater than one is used for a sequence object that will be used concurrently by multiple backends. Each backend will allocate "cache" successive sequence values @@ -273,7 +277,8 @@ SELECT last_value FROM sequence_name; will be lost. Furthermore, although multiple backends are guaranteed to allocate distinct sequence values, the values may be generated out of sequence when all the backends are considered. (For example, with a cache - setting of 10, backend A might reserve values 1..10 and return nextval=1, then + setting of 10, backend A might reserve values 1..10 and return nextval=1, +then backend B might reserve values 11..20 and return nextval=11 before backend A has generated nextval=2.) Thus, with a cache setting of one it is safe to assume that nextval values are generated sequentially; with a cache @@ -281,7 +286,7 @@ SELECT last_value FROM sequence_name; are all distinct, not that they are generated purely sequentially. Also, last_value will reflect the latest value reserved by any backend, whether or not it has yet been returned by nextval. - + @@ -327,6 +332,20 @@ nextval INSERT INTO distributors VALUES (NEXTVAL('serial'),'nothing'); + + + Set the sequence value after a COPY FROM: + +CREATE FUNCTION distributors_id_max() RETURNS INT4 + AS 'SELECT max(id) FROM distributors' + LANGUAGE 'sql'; +BEGIN; +COPY distributors FROM 'input_file'; +SELECT setval('serial', distributors_id_max()); +END; + + + diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 241d93c95d..4affd2cb26 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -117,16 +117,10 @@ requires the column_constraint_clause + Only one PRIMARY KEY clause may be specified for a table; PRIMARY KEY column - - as a table constraint - is mutually incompatible with - - PRIMARY KEY - - used as a column constraint. + (a table constraint) and PRIMARY KEY (a column constraint) are + mutually exclusive.. See the table constraint clause for more information. diff --git a/doc/src/sgml/ref/notify.sgml b/doc/src/sgml/ref/notify.sgml index 90b361b060..414b951f93 100644 --- a/doc/src/sgml/ref/notify.sgml +++ b/doc/src/sgml/ref/notify.sgml @@ -1,6 +1,6 @@ - + NOTIFY SQL - Language Statements diff --git a/doc/src/sgml/ref/set.sgml b/doc/src/sgml/ref/set.sgml index 8b84029471..d187d46bb8 100644 --- a/doc/src/sgml/ref/set.sgml +++ b/doc/src/sgml/ref/set.sgml @@ -450,11 +450,11 @@ DEFAULT Sets the maximum number of rows returned by a query to be unlimited. - - By default, there is no limit to the number of rows returned by a query. + + diff --git a/doc/src/sgml/ref/unlisten.sgml b/doc/src/sgml/ref/unlisten.sgml index 5ba9f2c551..cc18757675 100644 --- a/doc/src/sgml/ref/unlisten.sgml +++ b/doc/src/sgml/ref/unlisten.sgml @@ -10,12 +10,12 @@ UNLISTEN UNLISTEN -Stop listening for notification on a notify condition +Stop listening for notification -1998-10-07 +1998-10-19 UNLISTEN { notifyname | * } @@ -23,7 +23,7 @@ UNLISTEN { notifyname | * } -1998-10-07 +1998-10-19 Inputs @@ -37,7 +37,7 @@ Inputs </TERM> <LISTITEM> <PARA> -Name of notify condition to stop listening to. +Name of previously registered notify condition. <VARLISTENTRY> <TERM> @@ -53,7 +53,7 @@ All current listen registrations for this backend are cleared. <REFSECT2 ID="R2-SQL-UNLISTEN-2"> <REFSECT2INFO> -<DATE>1998-10-07</DATE> +<DATE>1998-10-19</DATE> </REFSECT2INFO> <TITLE> Outputs @@ -87,49 +87,75 @@ Acknowledgement that statement has executed. <REFSECT1 ID="R1-SQL-UNLISTEN-1"> <REFSECT1INFO> -<DATE>1998-10-07</DATE> +<DATE>1998-10-19</DATE> </REFSECT1INFO> <TITLE> Description +UNLISTEN +is used to remove an existing NOTIFY registration. UNLISTEN cancels any existing registration of the current -Postgres backend as a listener on the notify +Postgres session as a listener on the notify condition notifyname. -The special condition name "*" means to cancel all listener registrations -for the current backend. +The special condition wildcard "*" cancels all listener registrations +for the current session. -The backend does not complain if you UNLISTEN something you were not -listening for. + +contains a more extensive +discussion of the use of LISTEN and +NOTIFY. + + +1998-10-19 + + +Notes + +classname +needs not to be a valid class name but can be any string valid +as a name up to 32 characters long. + + +The backend does not complain if you UNLISTEN something you were not +listening for. Each backend will automatically execute UNLISTEN * when exiting. -The reference page for NOTIFY contains a more extensive -discussion of the use of LISTEN and -NOTIFY. +A restriction in some previous releases of + Postgres that a +classname +which does not correspond to an actual table must be enclosed in double-quotes +is no longer present. + + Usage - - -postgres=> listen virtual; + + + +postgres=> LISTEN virtual; LISTEN -postgres=> notify virtual; +postgres=> NOTIFY virtual; NOTIFY ASYNC NOTIFY of 'virtual' from backend pid '12317' received -postgres=> unlisten virtual; + + + +postgres=> UNLISTEN virtual; UNLISTEN -postgres=> notify virtual; +postgres=> NOTIFY virtual; NOTIFY -- notice no NOTIFY event is received postgres=> - + @@ -141,11 +167,12 @@ Compatibility -1998-10-07 +1998-10-19 SQL92 There is no UNLISTEN in SQL92. +