Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3600fd3

Browse files
committed
Major man page update from Tom Lane. c
1 parentf99dcd6 commit3600fd3

File tree

3 files changed

+60
-37
lines changed

3 files changed

+60
-37
lines changed

‎src/backend/nodes/outfuncs.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.38 1998/07/13 21:27:58 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.39 1998/07/14 01:45:24 momjian Exp $
1111
*
1212
* NOTES
1313
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -660,10 +660,7 @@ _outResdom(StringInfo str, Resdom *node)
660660
sprintf(buf," :restypmod %d ",node->restypmod);
661661
appendStringInfo(str,buf);
662662
appendStringInfo(str," :resname ");
663-
if (*node->resname)
664-
sprintf(buf,"\"%s\"",node->resname);/* fix for SELECT col AS "my name" */
665-
else
666-
buf[0]='\0';
663+
sprintf(buf,"\"%s\"",node->resname);/* fix for SELECT col AS "my name" */
667664
appendStringInfo(str,buf);
668665
sprintf(buf," :reskey %d ",node->reskey);
669666
appendStringInfo(str,buf);
@@ -1506,7 +1503,6 @@ _outDatum(StringInfo str, Datum value, Oid type)
15061503
appendStringInfo(str,buf);
15071504
}
15081505
}
1509-
15101506
}
15111507

15121508
staticvoid

‎src/backend/nodes/readfuncs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.30 1998/06/15 19:28:33 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.31 1998/07/14 01:45:24 momjian Exp $
1111
*
1212
* NOTES
1313
* Most of the read functions for plan nodes are tested. (In fact, they
@@ -716,7 +716,7 @@ _readResdom()
716716
else
717717
{
718718
local_node->resname= (char*)palloc(length+1);
719-
StrNCpy(local_node->resname,token,length+1);
719+
StrNCpy(local_node->resname,token+1,length+1-2);/* strip quotes */
720720
}
721721

722722
token=lsptok(NULL,&length);/* eat :reskey */

‎src/man/create_sequence.l

Lines changed: 56 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" This is -*-nroff-*-
22
.\" XXX standard disclaimer belongs here....
3-
.\" $Header: /cvsroot/pgsql/src/man/Attic/create_sequence.l,v 1.4 1998/06/23 17:52:32 momjian Exp $
4-
.TH "CREATE SEQUENCE" SQL04/01/97 PostgreSQL PostgreSQL
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/create_sequence.l,v 1.5 1998/07/14 01:45:25 momjian Exp $
4+
.TH "CREATE SEQUENCE" SQL07/13/98 PostgreSQL PostgreSQL
55
.SH NAME
66
create sequence - create a new sequence number generator
77
.SH SYNOPSIS
@@ -17,7 +17,7 @@ create sequence - create a new sequence number generator
1717
.SH DESCRIPTION
1818
.BR"Create sequence"
1919
will enter a new sequence number generator into the current data base.
20-
Actually, new single block
20+
Actually,anew single-record
2121
.BR table
2222
with name
2323
.IR seqname
@@ -26,23 +26,23 @@ The generator will be
2626
\*(lqowned\*(rq by the user issuing the command.
2727
.PP
2828
The
29-
.BR"increment"
30-
is optional clause. Positivevalue will make ascending sequence,
29+
.BR increment
30+
clauseis optional. A positivevalue will make an ascending sequence,
3131
negative - descending. Default value is 1.
3232
.PP
3333
The optional integer
3434
.BR minvalue
35-
determines the minimum valuea sequence canbe. Defaults are
35+
determines the minimum valuethe sequence cangenerate. Defaults are
3636
1/-2147483647 for ascending/descending sequences.
3737
.PP
38-
Use optional integer
38+
The optional integer
3939
.BR maxvalue
40-
to determinethe maximum valuefor sequence. Defaults are
40+
determinesthe maximum valuethe sequence can generate. Defaults are
4141
2147483647/-1 for ascending/descending sequences.
4242
.PP
43-
Theoptinal
44-
.BR"start"
45-
valueenables sequencetobegin anywhere. Default is
43+
Theoptional
44+
.BR start
45+
valuesets the first valuetobe generated. Default is
4646
.BR minvalue
4747
for ascending sequences and
4848
.BR maxvalue
@@ -52,42 +52,69 @@ The
5252
.BR cache
5353
option enables sequence numbers to be preallocated and
5454
stored in memory for faster access. The minimum value is 1
55-
(i.e. - no cache) and it is default.
56-
.BR NOTE:
57-
each backend uses own cache to store allocated numbers.
58-
Cached but not used in current session numbers will be lost.
55+
(one value will be allocated at a time, i.e., no cache)
56+
and that is the default. See below for details.
5957
.PP
6058
The optional
6159
.BR cycle
62-
keyword may be used to enable sequence to continuewhen the
60+
keyword may be used to enablethesequence to continueafter the
6361
.BR maxvalue/minvalue
6462
has been reached by ascending/descending sequence.
6563
If the limit is reached, the next number generated will be
6664
whatever the
6765
.BR minvalue/maxvalue
6866
is.
6967
.PP
70-
After sequence created,You may use function
68+
Afterasequenceobject has beencreated,you may use the function
7169
.BR nextval
72-
with sequence name as argument to get new number from sequence
73-
specified.
74-
Function
70+
with the sequence name as argument to generate a new number from the
71+
specified sequence.
72+
.PP
73+
The function
7574
.BR currval
7675
('sequence_name')
77-
may be used todeterminenumber returned by last call to
76+
may be used tore-fetch thenumber returned by the last call to
7877
.BR nextval
79-
for specified sequence in current session.
78+
for the specified sequence in the current session.
79+
.BR NOTE:
80+
currval will return an error if nextval has never been called for the
81+
given sequence in the current backend session. Also beware that it
82+
does not give the last number ever allocated, only the last one allocated
83+
by this backend.
8084
.PP
85+
Use a query like
8186
.nf
82-
Use query like
83-
84-
select * from <sequence_name>;
85-
86-
to get parameters of a sequence.
87+
SELECT * FROM <sequence_name>;
8788
.fi
89+
to get the parameters of a sequence. Aside from fetching the original
90+
parameters, you can use
91+
.nf
92+
SELECT last_value FROM <sequence_name>;
93+
.fi
94+
to obtain the last value allocated by any backend.
8895
.PP
89-
Low-level locking is used to enable multiple simultaneous calls
90-
to a generator.
96+
Low-level locking is used to ensure that multiple backends can safely use
97+
a sequence object concurrently.
98+
.PP
99+
.BR NOTE:
100+
Unexpected results may be obtained if a cache setting greater than one
101+
is used for a sequence object that will be used concurrently by multiple
102+
backends. Each backend will allocate "cache" successive sequence values
103+
during one access to the sequence object and increase the sequence
104+
object's last_value accordingly. Then, the next cache-1 uses of nextval
105+
within that backend simply return the preallocated values without touching
106+
the shared object. So, numbers allocated but not used in the current session
107+
will be lost. Furthermore, although multiple backends are guaranteed to
108+
allocate distinct sequence values, the values may be generated out of
109+
sequence when all the backends are considered. (For example, with a cache
110+
setting of 10, backend A might reserve values 1..10 and return nextval=1, then
111+
backend B might reserve values 11..20 and return nextval=11 before backend
112+
A has generated nextval=2.) Thus, with a cache setting of one it is safe
113+
to assume that nextval values are generated sequentially; with a cache
114+
setting greater than one you should only assume that the nextval values
115+
are all distinct, not that they are generated purely sequentially.
116+
Also, last_value will reflect the latest value reserved by any backend,
117+
whether or not it has yet been returned by nextval.
91118
.PP
92119
.SH EXAMPLES
93120
.nf

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp