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
7e1955b8
Commit
7e1955b8
authored
Jan 16, 2014
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs: update PL/pgSQL docs about the use of := and =
parent
a472ae1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
doc/src/sgml/plpgsql.sgml
doc/src/sgml/plpgsql.sgml
+11
-6
src/pl/plpgsql/src/pl_gram.y
src/pl/plpgsql/src/pl_gram.y
+6
-1
No files found.
doc/src/sgml/plpgsql.sgml
View file @
7e1955b8
...
@@ -328,7 +328,7 @@ arow RECORD;
...
@@ -328,7 +328,7 @@ arow RECORD;
<para>
<para>
The general syntax of a variable declaration is:
The general syntax of a variable declaration is:
<synopsis>
<synopsis>
<replaceable>name</replaceable> <optional> CONSTANT </optional> <replaceable>type</replaceable> <optional> COLLATE <replaceable>collation_name</replaceable> </optional> <optional> NOT NULL </optional> <optional> { DEFAULT | := } <replaceable>expression</replaceable> </optional>;
<replaceable>name</replaceable> <optional> CONSTANT </optional> <replaceable>type</replaceable> <optional> COLLATE <replaceable>collation_name</replaceable> </optional> <optional> NOT NULL </optional> <optional> { DEFAULT | :=
| =
} <replaceable>expression</replaceable> </optional>;
</synopsis>
</synopsis>
The <literal>DEFAULT</> clause, if given, specifies the initial value assigned
The <literal>DEFAULT</> clause, if given, specifies the initial value assigned
to the variable when the block is entered. If the <literal>DEFAULT</> clause
to the variable when the block is entered. If the <literal>DEFAULT</> clause
...
@@ -343,6 +343,8 @@ arow RECORD;
...
@@ -343,6 +343,8 @@ arow RECORD;
is specified, an assignment of a null value results in a run-time
is specified, an assignment of a null value results in a run-time
error. All variables declared as <literal>NOT NULL</>
error. All variables declared as <literal>NOT NULL</>
must have a nonnull default value specified.
must have a nonnull default value specified.
Equals (<literal>=</>) can be used instead of PL/SQL-compliant
<literal>:=</>.
</para>
</para>
<para>
<para>
...
@@ -866,7 +868,7 @@ PREPARE <replaceable>statement_name</>(integer, integer) AS SELECT $1 < $2;
...
@@ -866,7 +868,7 @@ PREPARE <replaceable>statement_name</>(integer, integer) AS SELECT $1 < $2;
An assignment of a value to a <application>PL/pgSQL</application>
An assignment of a value to a <application>PL/pgSQL</application>
variable is written as:
variable is written as:
<synopsis>
<synopsis>
<replaceable>variable</replaceable>
:=
<replaceable>expression</replaceable>;
<replaceable>variable</replaceable>
{ := | = }
<replaceable>expression</replaceable>;
</synopsis>
</synopsis>
As explained previously, the expression in such a statement is evaluated
As explained previously, the expression in such a statement is evaluated
by means of an SQL <command>SELECT</> command sent to the main
by means of an SQL <command>SELECT</> command sent to the main
...
@@ -874,7 +876,8 @@ PREPARE <replaceable>statement_name</>(integer, integer) AS SELECT $1 < $2;
...
@@ -874,7 +876,8 @@ PREPARE <replaceable>statement_name</>(integer, integer) AS SELECT $1 < $2;
a row value, if the variable is a row or record variable). The target
a row value, if the variable is a row or record variable). The target
variable can be a simple variable (optionally qualified with a block
variable can be a simple variable (optionally qualified with a block
name), a field of a row or record variable, or an element of an array
name), a field of a row or record variable, or an element of an array
that is a simple variable or field.
that is a simple variable or field. Equals (<literal>=</>) can be
used instead of PL/SQL-compliant <literal>:=</>.
</para>
</para>
<para>
<para>
...
@@ -1411,7 +1414,7 @@ EXECUTE format('UPDATE tbl SET %I = $1 WHERE key = $2', colname)
...
@@ -1411,7 +1414,7 @@ EXECUTE format('UPDATE tbl SET %I = $1 WHERE key = $2', colname)
command, which has the form:
command, which has the form:
<synopsis>
<synopsis>
GET <optional> CURRENT </optional> DIAGNOSTICS <replaceable>variable</replaceable>
=
<replaceable>item</replaceable> <optional> , ... </optional>;
GET <optional> CURRENT </optional> DIAGNOSTICS <replaceable>variable</replaceable>
{ = | := }
<replaceable>item</replaceable> <optional> , ... </optional>;
</synopsis>
</synopsis>
This command allows retrieval of system status indicators. Each
This command allows retrieval of system status indicators. Each
...
@@ -1425,6 +1428,8 @@ GET <optional> CURRENT </optional> DIAGNOSTICS <replaceable>variable</replaceabl
...
@@ -1425,6 +1428,8 @@ GET <optional> CURRENT </optional> DIAGNOSTICS <replaceable>variable</replaceabl
<acronym>SQL</acronym> command. Note that <varname>RESULT_OID</>
<acronym>SQL</acronym> command. Note that <varname>RESULT_OID</>
is only useful after an <command>INSERT</command> command into a
is only useful after an <command>INSERT</command> command into a
table containing OIDs.
table containing OIDs.
Equals (<literal>:=</>) can be used instead of SQL-standard
<literal>=</> for <command>GET DIAGNOSTICS</>.
</para>
</para>
<para>
<para>
...
@@ -2672,7 +2677,7 @@ SELECT merge_db(1, 'dennis');
...
@@ -2672,7 +2677,7 @@ SELECT merge_db(1, 'dennis');
<command>GET STACKED DIAGNOSTICS</command> command, which has the form:
<command>GET STACKED DIAGNOSTICS</command> command, which has the form:
<synopsis>
<synopsis>
GET STACKED DIAGNOSTICS <replaceable>variable</replaceable>
=
<replaceable>item</replaceable> <optional> , ... </optional>;
GET STACKED DIAGNOSTICS <replaceable>variable</replaceable>
{ = | := }
<replaceable>item</replaceable> <optional> , ... </optional>;
</synopsis>
</synopsis>
Each <replaceable>item</replaceable> is a key word identifying a status
Each <replaceable>item</replaceable> is a key word identifying a status
...
@@ -2776,7 +2781,7 @@ END;
...
@@ -2776,7 +2781,7 @@ END;
<para>
<para>
<synopsis>
<synopsis>
GET <optional> CURRENT </optional> DIAGNOSTICS <replaceable>variable</replaceable>
=
<replaceable>PG_CONTEXT</replaceable> <optional> , ... </optional>;
GET <optional> CURRENT </optional> DIAGNOSTICS <replaceable>variable</replaceable>
{ = | := }
<replaceable>PG_CONTEXT</replaceable> <optional> , ... </optional>;
</synopsis>
</synopsis>
...
...
src/pl/plpgsql/src/pl_gram.y
View file @
7e1955b8
...
@@ -796,7 +796,12 @@ decl_defkey : assign_operator
...
@@ -796,7 +796,12 @@ decl_defkey : assign_operator
| K_DEFAULT
| K_DEFAULT
;
;
assign_operator : '=' /* not documented because it might be removed someday */
/*
* Ada-based PL/SQL uses := for assignment and variable defaults, while
* the SQL standard uses equals for these cases and for GET
* DIAGNOSTICS, so we support both. FOR and OPEN only support :=.
*/
assign_operator : '='
| COLON_EQUALS
| COLON_EQUALS
;
;
...
...
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