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
95af0cb9
Commit
95af0cb9
authored
Sep 07, 1998
by
Thomas G. Lockhart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Postgres to support SQL92 syntax. Old syntax still works too.
parent
4dce924b
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
269 additions
and
284 deletions
+269
-284
doc/src/sgml/ref/declare.sgml
doc/src/sgml/ref/declare.sgml
+149
-100
doc/src/sgml/ref/fetch.sgml
doc/src/sgml/ref/fetch.sgml
+106
-81
doc/src/sgml/ref/move.sgml
doc/src/sgml/ref/move.sgml
+14
-103
No files found.
doc/src/sgml/ref/declare.sgml
View file @
95af0cb9
This diff is collapsed.
Click to expand it.
doc/src/sgml/ref/fetch.sgml
View file @
95af0cb9
...
@@ -17,7 +17,9 @@ Gets rows using a cursor
...
@@ -17,7 +17,9 @@ Gets rows using a cursor
<DATE>1998-09-01</DATE>
<DATE>1998-09-01</DATE>
</REFSYNOPSISDIVINFO>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
<SYNOPSIS>
FETCH [ <REPLACEABLE CLASS="PARAMETER">selector</REPLACEABLE> ] { [ <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE> | ALL ] } { IN | FROM } <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
FETCH [ <REPLACEABLE CLASS="PARAMETER">selector</REPLACEABLE> ] [ <REPLACEABLE CLASS="PARAMETER">count</REPLACEABLE> ]
{ IN | FROM } <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
FETCH [ RELATIVE ] [ { [ <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE> | ALL | NEXT | PRIOR ] } ] FROM ] <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
</SYNOPSIS>
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-FETCH-1">
<REFSECT2 ID="R2-SQL-FETCH-1">
...
@@ -36,7 +38,8 @@ Inputs
...
@@ -36,7 +38,8 @@ Inputs
</TERM>
</TERM>
<LISTITEM>
<LISTITEM>
<PARA>
<PARA>
Selector define fetch direction and it can be one
<REPLACEABLE CLASS="PARAMETER">selector</REPLACEABLE>
defines the fetch direction. It can be one
the following:
the following:
<VARIABLELIST>
<VARIABLELIST>
...
@@ -46,8 +49,8 @@ FORWARD
...
@@ -46,8 +49,8 @@ FORWARD
</TERM>
</TERM>
<LISTITEM>
<LISTITEM>
<PARA>
<PARA>
fetch next row(s)
, it is assumed by
default
fetch next row(s)
. This is the
default
if selector
is omitted.
if <REPLACEABLE CLASS="PARAMETER">selector</REPLACEABLE>
is omitted.
<VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<TERM>
...
@@ -57,15 +60,35 @@ BACKWARD
...
@@ -57,15 +60,35 @@ BACKWARD
<PARA>
<PARA>
fetch previous row(s).
fetch previous row(s).
<VARLISTENTRY>
<TERM>
RELATIVE
</TERM>
<LISTITEM>
<PARA>
Noise word for SQL92 compatibility.
</VARIABLELIST>
</VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">count</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
<REPLACEABLE CLASS="PARAMETER">count</REPLACEABLE>
determines how many rows to fetch. It can be one of the following:
<VARIABLELIST>
<VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<TERM>
<REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE>
<REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE>
</TERM>
</TERM>
<LISTITEM>
<LISTITEM>
<PARA>
<PARA>
An unsigned integer that specify how many rows to fetch.
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.
<VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<TERM>
...
@@ -75,6 +98,24 @@ ALL
...
@@ -75,6 +98,24 @@ ALL
<PARA>
<PARA>
Retrieve all remaining rows.
Retrieve all remaining rows.
<VARLISTENTRY>
<TERM>
NEXT
</TERM>
<LISTITEM>
<PARA>
Equivalent to specifying a count of <command>1</command>.
<VARLISTENTRY>
<TERM>
PRIOR
</TERM>
<LISTITEM>
<PARA>
Equivalent to specifying a count of <command>-1</command>.
</VARIABLELIST>
<VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<TERM>
<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
...
@@ -108,6 +149,34 @@ NOTICE: PerformPortalFetch: portal "<REPLACEABLE CLASS="PARAMETER">cursor</REPL
...
@@ -108,6 +149,34 @@ NOTICE: PerformPortalFetch: portal "<REPLACEABLE CLASS="PARAMETER">cursor</REPL
If <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> is not previously declared.
If <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> is not previously declared.
The cursor must be declared within a transaction block.
The cursor must be declared within a transaction block.
<VARLISTENTRY>
<TERM>
NOTICE: FETCH/ABSOLUTE not supported, using RELATIVE
</TERM>
<LISTITEM>
<PARA>
<productname>Postgres</productname> does not support absolute
positioning of cursors.
<VARLISTENTRY>
<TERM>
ERROR: FETCH/RELATIVE at current position is not supported
</TERM>
<LISTITEM>
<PARA>
<acronym>SQL92</acronym> allows one to repetatively retrieve the cursor
at its "current position" using the syntax
<programlisting>
FETCH RELATIVE 0 FROM <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
</programlisting>
<productname>Postgres</productname> 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 <productname>Postgres</productname>
assumes that the user intended <acronym>SQL92</acronym> behavior
and returns this error message.
</variablelist>
</variablelist>
</REFSECT2>
</REFSECT2>
...
@@ -122,13 +191,30 @@ Description
...
@@ -122,13 +191,30 @@ Description
</TITLE>
</TITLE>
<PARA>
<PARA>
FETCH allows a user to retrieve rows using a cursor.
FETCH allows a user to retrieve rows using a cursor.
The number of rows retrieved is specified by #.
The number of rows retrieved is specified by
<REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE>.
If the number of rows remaining in the cursor is less
If the number of rows remaining in the cursor is less
than #, then only those available are fetched.
than <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE>,
then only those available are fetched.
Substituting the keyword ALL in place of a number will
Substituting the keyword ALL in place of a number will
cause all remaining rows in the cursor to be retrieved.
cause all remaining rows in the cursor to be retrieved.
Instances may be fetched in both forward and backward
Instances may be fetched in both FORWARD and BACKWARD
directions. The default direction is forward.
directions. The default direction is FORWARD.
<tip>
<para>
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,
<command>FORWARD -1</command> is the same as <command>BACKWARD 1</command>.
</tip>
<para>
Note that the FORWARD and BACKWARD keywords are
<productname>Postgres</productname> extensions.
The <acronym>SQL92</acronym> syntax is also supported, specified
in the second form of the command. See below for details
on compatibility issues.
<para>
<para>
Once all rows are fetched, every other fetch access returns
Once all rows are fetched, every other fetch access returns
...
@@ -138,8 +224,9 @@ Description
...
@@ -138,8 +224,9 @@ Description
Updating data in a cursor is not supported by
Updating data in a cursor is not supported by
<productname>Postgres</productname>,
<productname>Postgres</productname>,
because mapping cursor updates back to base tables is
because mapping cursor updates back to base tables is
not generally possible, similarly to VIEW updates. Consequently,
not generally possible, as is also the case with VIEW updates.
users must issue explicit replace commands to update data.
Consequently,
users must issue explicit UPDATE commands to replace data.
<para>
<para>
Cursors may only be used inside of transactions because
Cursors may only be used inside of transactions because
...
@@ -216,87 +303,25 @@ Compatibility
...
@@ -216,87 +303,25 @@ Compatibility
SQL92
SQL92
</TITLE>
</TITLE>
<PARA>
<PARA>
SQL92 specifies some additional capabilities for FETCH statement.
SQL92 allows absolute positioning of the cursor for
FETCH, and allows placing the results into explicit variables.
<synopsis>
<synopsis>
FETCH [ [ <REPLACEABLE CLASS="PARAMETER">selector</REPLACEABLE> ] FROM ] <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
FETCH ABSOLUTE <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE>
FROM <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
INTO :<REPLACEABLE CLASS="PARAMETER">variable</REPLACEABLE> [, ...]
INTO :<REPLACEABLE CLASS="PARAMETER">variable</REPLACEABLE> [, ...]
</synopsis>
</synopsis>
<VARIABLELIST>
<VARIABLELIST>
<VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<TERM>
<REPLACEABLE CLASS="PARAMETER">selector</REPLACEABLE>
ABSOLUTE
</TERM>
<LISTITEM>
<PARA>
Defines the fetch direction with one of the following values:
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
NEXT
</TERM>
<LISTITEM>
<PARA>
Fetch next row, it is assumed by default
if selector is omitted.
This is the only legal selector unless cursor is
declared with the SCROLL option.
<VARLISTENTRY>
<TERM>
PRIOR
</TERM>
<LISTITEM>
<PARA>
Fetch previous row.
<VARLISTENTRY>
<TERM>
FIRST
</TERM>
<LISTITEM>
<PARA>
Fetch first row.
<VARLISTENTRY>
<TERM>
LAST
</TERM>
<LISTITEM>
<PARA>
Fetch last row.
<VARLISTENTRY>
<TERM>
ABSOLUTE <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
Refers to the <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE>th row
in the table associated with the cursor.
<VARLISTENTRY>
<TERM>
RELATIVE <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
Refers to the <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE>th row
relative to the cursor position.
A negative number is equivalent to reversing the sense of the FORWARD and
BACKWARD keywords.
</variablelist>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
</TERM>
</TERM>
<LISTITEM>
<LISTITEM>
<PARA>
<PARA>
A cursor previously defined in the same transaction block using BEGIN and DECLARE.
The cursor should be positioned to the specified absolute
row number. All row numbers in <productname>Postgres</productname>
are relative numbers so this capability is not supported.
<VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<TERM>
...
...
doc/src/sgml/ref/move.sgml
View file @
95af0cb9
...
@@ -18,105 +18,11 @@ Moves cursor position
...
@@ -18,105 +18,11 @@ Moves cursor position
<DATE>1998-09-01</DATE>
<DATE>1998-09-01</DATE>
</REFSYNOPSISDIVINFO>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
<SYNOPSIS>
MOVE [ <REPLACEABLE CLASS="PARAMETER">selector</REPLACEABLE> ] { [ <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE> | ALL ] } IN <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
MOVE [ <REPLACEABLE CLASS="PARAMETER">selector</REPLACEABLE> ] [ <REPLACEABLE CLASS="PARAMETER">count</REPLACEABLE> ]
{ IN | FROM } <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
FETCH [ RELATIVE ] [ { [ <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE> | ALL | NEXT | PRIOR ] } ] FROM ] <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
</SYNOPSIS>
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-MOVE-1">
<REFSECT2INFO>
<DATE>1998-09-01</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">selector</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
<variablelist>
<varlistentry>
<term>
FORWARD
</term>
<listitem>
<para>
Skip next row(s), it is assumed by default
if selector is omitted.
<varlistentry>
<term>
BACKWARD
</term>
<listitem>
<para>
Skip previous row(s).
</variablelist>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
An unsigned integer that specify how many rows to skip.
<VARLISTENTRY>
<TERM>
ALL
</TERM>
<LISTITEM>
<PARA>
Skip all remaining rows.
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
An open cursor's name.
</VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-MOVE-2">
<REFSECT2INFO>
<DATE>1998-09-01</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
MOVE
</TERM>
<LISTITEM>
<PARA>
Message returned if successfully.
<VARLISTENTRY>
<TERM>
NOTICE: PerformPortalFetch: portal <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> not found.
</TERM>
<LISTITEM>
<PARA>
If cursor is not declared.
</VARIABLELIST>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-MOVE-1">
<REFSECT1 ID="R1-SQL-MOVE-1">
<REFSECT1INFO>
<REFSECT1INFO>
<DATE>1998-04-15</DATE>
<DATE>1998-04-15</DATE>
...
@@ -125,9 +31,13 @@ NOTICE: PerformPortalFetch: portal <REPLACEABLE CLASS="PARAMETER">cursor</REPLA
...
@@ -125,9 +31,13 @@ NOTICE: PerformPortalFetch: portal <REPLACEABLE CLASS="PARAMETER">cursor</REPLA
Description
Description
</TITLE>
</TITLE>
<PARA>
<PARA>
MOVE allows a user to move cursor position for specified
MOVE allows a user to move cursor position a specified
number of rows. MOVE works like fetch command: it
number of rows. MOVE works like the FETCH command, but only
fetches rows, but put them nowhere.
positions the cursor and does
not return rows.
<para>
Refer to the FETCH command for details on syntax and usage.
<REFSECT2 ID="R2-SQL-MOVE-3">
<REFSECT2 ID="R2-SQL-MOVE-3">
<REFSECT2INFO>
<REFSECT2INFO>
...
@@ -140,9 +50,9 @@ Notes
...
@@ -140,9 +50,9 @@ Notes
MOVE is a <productname>Postgres</productname> language extension.
MOVE is a <productname>Postgres</productname> language extension.
<para>
<para>
Refer to FETCH
statements for further
description
Refer to FETCH
for a
description
of valid arguments.
of valid arguments.
Refer to DECLARE
statements
to declare a cursor.
Refer to DECLARE to declare a cursor.
Refer to BEGIN WORK, COMMIT WORK, ROLLBACK WORK statements
Refer to BEGIN WORK, COMMIT WORK, ROLLBACK WORK statements
for further information about transactions.
for further information about transactions.
...
@@ -195,5 +105,6 @@ Compatibility
...
@@ -195,5 +105,6 @@ Compatibility
SQL92
SQL92
</TITLE>
</TITLE>
<PARA>
<PARA>
There is no SQL92 MOVE statement.
There is no SQL92 MOVE statement. Instead, <acronym>SQL92</acronym> allows
one to FETCH rows from an absolute cursor position.
</REFENTRY>
</REFENTRY>
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