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
360e61e1
Commit
360e61e1
authored
Oct 14, 2001
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update FAQ.
parent
1ebc028c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
16 deletions
+8
-16
doc/FAQ
doc/FAQ
+4
-8
doc/src/FAQ/FAQ.html
doc/src/FAQ/FAQ.html
+4
-8
No files found.
doc/FAQ
View file @
360e61e1
Frequently Asked Questions (FAQ) for PostgreSQL
Last updated: S
at Oct 13 01:26:55
EDT 2001
Last updated: S
un Oct 14 19:27:20
EDT 2001
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
...
...
@@ -826,10 +826,8 @@ BYTEA bytea variable-length byte array (null-safe)
object with the nextval() function before inserting and then insert it
explicitly. Using the example table in 4.16.1, that might look like
this in Perl:
$sql = "SELECT nextval('person_id_seq')";
$newSerialID = ($conn->selectrow_array($sql))[0];
INSERT INTO person (id, name) VALUES ($newSerialID, 'Blaise Pascal');
$res = $dbh->do($sql);
new_id = output of "SELECT nextval('person_id_seq')"
INSERT INTO person (id, name) VALUES (new_id, 'Blaise Pascal');
You would then also have the new value stored in $newSerialID for use
in other queries (e.g., as a foreign key to the person table). Note
...
...
@@ -840,9 +838,7 @@ BYTEA bytea variable-length byte array (null-safe)
Alternatively, you could retrieve the assigned SERIAL value with the
currval() function after it was inserted by default, e.g.,
INSERT INTO person (name) VALUES ('Blaise Pascal');
$res = $conn->do($sql);
$sql = "SELECT currval('person_id_seq')";
$newSerialID = ($conn->selectrow_array($sql))[0];
new_id = output of "SELECT currval('person_id_seq')";
Finally, you could use the OID returned from the INSERT statement to
look up the default value, though this is probably the least portable
...
...
doc/src/FAQ/FAQ.html
View file @
360e61e1
...
...
@@ -12,7 +12,7 @@
alink=
"#0000FF"
>
<H1>
Frequently Asked Questions (FAQ) for PostgreSQL
</H1>
<P>
Last updated: S
at Oct 13 01:26:55
EDT 2001
</P>
<P>
Last updated: S
un Oct 14 19:27:20
EDT 2001
</P>
<P>
Current maintainer: Bruce Momjian (
<A
href=
"mailto:pgman@candle.pha.pa.us"
>
pgman@candle.pha.pa.us
</A>
)
<BR>
...
...
@@ -1050,10 +1050,8 @@ BYTEA bytea variable-length byte array (null-safe)
example table in
<A
href=
"#4.16.1"
>
4.16.1
</A>
, that might look like
this in Perl:
</P>
<PRE>
$sql = "SELECT nextval('person_id_seq')";
$newSerialID = ($conn->selectrow_array($sql))[0];
INSERT INTO person (id, name) VALUES ($newSerialID, 'Blaise Pascal');
$res = $dbh->do($sql);
new_id = output of "SELECT nextval('person_id_seq')"
INSERT INTO person (id, name) VALUES (new_id, 'Blaise Pascal');
</PRE>
You would then also have the new value stored in
<CODE>
$newSerialID
</CODE>
for use in other queries (e.g., as a
...
...
@@ -1068,9 +1066,7 @@ BYTEA bytea variable-length byte array (null-safe)
<I>
after
</I>
it was inserted by default, e.g.,
</P>
<PRE>
INSERT INTO person (name) VALUES ('Blaise Pascal');
$res = $conn->do($sql);
$sql = "SELECT currval('person_id_seq')";
$newSerialID = ($conn->selectrow_array($sql))[0];
new_id = output of "SELECT currval('person_id_seq')";
</PRE>
Finally, you could use the
<A
href=
"#4.17"
><SMALL>
OID
</SMALL></A>
returned from the
<SMALL>
INSERT
</SMALL>
statement to look up the
...
...
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