Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
3600fd32
Commit
3600fd32
authored
Jul 14, 1998
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Major man page update from Tom Lane. c
parent
f99dcd6d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
37 deletions
+60
-37
src/backend/nodes/outfuncs.c
src/backend/nodes/outfuncs.c
+2
-6
src/backend/nodes/readfuncs.c
src/backend/nodes/readfuncs.c
+2
-2
src/man/create_sequence.l
src/man/create_sequence.l
+56
-29
No files found.
src/backend/nodes/outfuncs.c
View file @
3600fd32
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.3
8 1998/07/13 21:27:58
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.3
9 1998/07/14 01:45:24
momjian Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
...
...
@@ -660,10 +660,7 @@ _outResdom(StringInfo str, Resdom *node)
sprintf
(
buf
,
" :restypmod %d "
,
node
->
restypmod
);
appendStringInfo
(
str
,
buf
);
appendStringInfo
(
str
,
" :resname "
);
if
(
*
node
->
resname
)
sprintf
(
buf
,
"
\"
%s
\"
"
,
node
->
resname
);
/* fix for SELECT col AS "my name" */
else
buf
[
0
]
=
'\0'
;
sprintf
(
buf
,
"
\"
%s
\"
"
,
node
->
resname
);
/* fix for SELECT col AS "my name" */
appendStringInfo
(
str
,
buf
);
sprintf
(
buf
,
" :reskey %d "
,
node
->
reskey
);
appendStringInfo
(
str
,
buf
);
...
...
@@ -1506,7 +1503,6 @@ _outDatum(StringInfo str, Datum value, Oid type)
appendStringInfo
(
str
,
buf
);
}
}
}
static
void
...
...
src/backend/nodes/readfuncs.c
View file @
3600fd32
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.3
0 1998/06/15 19:28:33
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.3
1 1998/07/14 01:45:24
momjian Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
...
...
@@ -716,7 +716,7 @@ _readResdom()
else
{
local_node
->
resname
=
(
char
*
)
palloc
(
length
+
1
);
StrNCpy
(
local_node
->
resname
,
token
,
length
+
1
);
StrNCpy
(
local_node
->
resname
,
token
+
1
,
length
+
1
-
2
);
/* strip quotes */
}
token
=
lsptok
(
NULL
,
&
length
);
/* eat :reskey */
...
...
src/man/create_sequence.l
View file @
3600fd32
.\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here....
.\" $Header: /cvsroot/pgsql/src/man/Attic/create_sequence.l,v 1.
4 1998/06/23 17:52:32
momjian Exp $
.TH "CREATE SEQUENCE" SQL 0
4/01/97
PostgreSQL PostgreSQL
.\" $Header: /cvsroot/pgsql/src/man/Attic/create_sequence.l,v 1.
5 1998/07/14 01:45:25
momjian Exp $
.TH "CREATE SEQUENCE" SQL 0
7/13/98
PostgreSQL PostgreSQL
.SH NAME
create sequence - create a new sequence number generator
.SH SYNOPSIS
...
...
@@ -17,7 +17,7 @@ create sequence - create a new sequence number generator
.SH DESCRIPTION
.BR "Create sequence"
will enter a new sequence number generator into the current data base.
Actually,
new single block
Actually,
a new single-record
.BR table
with name
.IR seqname
...
...
@@ -26,23 +26,23 @@ The generator will be
\*(lqowned\*(rq by the user issuing the command.
.PP
The
.BR
"increment"
is optional clause. Positive value will make
ascending sequence,
.BR
increment
clause is optional. A positive value will make an
ascending sequence,
negative - descending. Default value is 1.
.PP
The optional integer
.BR minvalue
determines the minimum value
a sequence can b
e. Defaults are
determines the minimum value
the sequence can generat
e. Defaults are
1/-2147483647 for ascending/descending sequences.
.PP
Us
e optional integer
Th
e optional integer
.BR maxvalue
to determine the maximum value for sequenc
e. Defaults are
determines the maximum value the sequence can generat
e. Defaults are
2147483647/-1 for ascending/descending sequences.
.PP
The optinal
.BR
"start"
value
enables sequence to begin anywhere
. Default is
The opti
o
nal
.BR
start
value
sets the first value to be generated
. Default is
.BR minvalue
for ascending sequences and
.BR maxvalue
...
...
@@ -52,14 +52,12 @@ The
.BR cache
option enables sequence numbers to be preallocated and
stored in memory for faster access. The minimum value is 1
(i.e. - no cache) and it is default.
.BR NOTE:
each backend uses own cache to store allocated numbers.
Cached but not used in current session numbers will be lost.
(one value will be allocated at a time, i.e., no cache)
and that is the default. See below for details.
.PP
The optional
.BR cycle
keyword may be used to enable
sequence to continue when
the
keyword may be used to enable
the sequence to continue after
the
.BR maxvalue/minvalue
has been reached by ascending/descending sequence.
If the limit is reached, the next number generated will be
...
...
@@ -67,27 +65,56 @@ whatever the
.BR minvalue/maxvalue
is.
.PP
After
sequence created, You may us
e function
After
a sequence object has been created, you may use th
e function
.BR nextval
with sequence name as argument to get new number from sequence
specified.
Function
with the sequence name as argument to generate a new number from the
specified sequence.
.PP
The function
.BR currval
('sequence_name')
may be used to
determine number returned by
last call to
may be used to
re-fetch the number returned by the
last call to
.BR nextval
for specified sequence in current session.
for the specified sequence in the current session.
.BR NOTE:
currval will return an error if nextval has never been called for the
given sequence in the current backend session. Also beware that it
does not give the last number ever allocated, only the last one allocated
by this backend.
.PP
Use a query like
.nf
Use query like
select * from <sequence_name>;
to get parameters of a sequence.
SELECT * FROM <sequence_name>;
.fi
to get the parameters of a sequence. Aside from fetching the original
parameters, you can use
.nf
SELECT last_value FROM <sequence_name>;
.fi
to obtain the last value allocated by any backend.
.PP
Low-level locking is used to enable multiple simultaneous calls
to a generator.
Low-level locking is used to ensure that multiple backends can safely use
a sequence object concurrently.
.PP
.BR 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
during one access to the sequence object and increase the sequence
object's last_value accordingly. Then, the next cache-1 uses of nextval
within that backend simply return the preallocated values without touching
the shared object. So, numbers allocated but not used in the current session
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
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
setting greater than one you should only assume that the nextval values
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.
.PP
.SH EXAMPLES
.nf
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment