public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bruce Momjian <[email protected]>
To: Pavel Stehule <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: pgsql-docs <[email protected]>
Subject: Re: remove undocumented assign syntax from plpgsql doc
Date: Wed, 15 Jan 2014 11:32:59 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAFj8pRCWRHFbi9FQcfHY++Yoy6s78Ph9Bs3jS_AJ2hgvvx1HLQ@mail.gmail.com>
References: <[email protected]>
	<CAFj8pRAyAOi9ZJbxMBPkW+r03n+zQm6idojWWH2n17h8NGyXBA@mail.gmail.com>
	<[email protected]>
	<CAFj8pRAPNM0__k9FsBJc1ubyHq8xoU0TxgoHdLEud7sV=OaTDA@mail.gmail.com>
	<[email protected]>
	<CAFj8pRAz=uZx4=egdrx1i3mHLSjBGtVb8+5DUY7tnCC=GNixDA@mail.gmail.com>
	<[email protected]>
	<CAFj8pRBRCNFjVGoMz-uVDJ3jZT5nO_5KQx4WuG20t+pzXKjEGA@mail.gmail.com>
	<[email protected]>
	<CAFj8pRCWRHFbi9FQcfHY++Yoy6s78Ph9Bs3jS_AJ2hgvvx1HLQ@mail.gmail.com>
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgsql-docs>

On Wed, Jan 15, 2014 at 04:55:11PM +0100, Pavel Stehule wrote:
>     The problem is that these are philosophical issues that are not normally
>     covered in our docs.  What I have done is to add a mention of which
>     option is compliant to the new text.  Patch attached.
> 
>     Is GET DIAGNOSTICS defined in the standard for SQL/PSM only or for
>     generic SQL?
> 
> 
> 
> I found this statement in ANSI SQL 92 - and few minutes searching - it is in
> generic SQL - today "SQL framework" part and it is enhanced in "SQL/PSM"

OK, patch updated.

-- 
  Bruce Momjian  <[email protected]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs


Attachments:

  [text/x-diff] assign.diff (6.2K, 2-assign.diff)
  download | inline diff:
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
new file mode 100644
index ca2c2b5..48880ce
*** a/doc/src/sgml/plpgsql.sgml
--- b/doc/src/sgml/plpgsql.sgml
*************** arow RECORD;
*** 328,334 ****
      <para>
       The general syntax of a variable declaration is:
  <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>;
  </synopsis>
        The <literal>DEFAULT</> clause, if given, specifies the initial value assigned
        to the variable when the block is entered.  If the <literal>DEFAULT</> clause
--- 328,334 ----
      <para>
       The general syntax of a variable declaration is:
  <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>;
  </synopsis>
        The <literal>DEFAULT</> clause, if given, specifies the initial value assigned
        to the variable when the block is entered.  If the <literal>DEFAULT</> clause
*************** arow RECORD;
*** 343,348 ****
--- 343,350 ----
        is specified, an assignment of a null value results in a run-time
        error. All variables declared as <literal>NOT NULL</>
        must have a nonnull default value specified.
+       Equals (<literal>=</>) can be used instead of PL/SQL-compliant
+       <literal>:=</>.
       </para>
  
       <para>
*************** PREPARE <replaceable>statement_name</>(i
*** 866,872 ****
       An assignment of a value to a <application>PL/pgSQL</application>
       variable is written as:
  <synopsis>
! <replaceable>variable</replaceable> := <replaceable>expression</replaceable>;
  </synopsis>
       As explained previously, the expression in such a statement is evaluated
       by means of an SQL <command>SELECT</> command sent to the main
--- 868,874 ----
       An assignment of a value to a <application>PL/pgSQL</application>
       variable is written as:
  <synopsis>
! <replaceable>variable</replaceable> { := | = } <replaceable>expression</replaceable>;
  </synopsis>
       As explained previously, the expression in such a statement is evaluated
       by means of an SQL <command>SELECT</> command sent to the main
*************** PREPARE <replaceable>statement_name</>(i
*** 874,880 ****
       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
       name), a field of a row or record variable, or an element of an array
!      that is a simple variable or field.
      </para>
  
      <para>
--- 876,883 ----
       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
       name), a field of a row or record variable, or an element of an array
!      that is a simple variable or field.  Equals (<literal>=</>) can be
!      used instead of PL/SQL-compliant <literal>:=</>.
      </para>
  
      <para>
*************** EXECUTE format('UPDATE tbl SET %I = $1 W
*** 1411,1417 ****
       command, which has the form:
  
  <synopsis>
! GET <optional> CURRENT </optional> DIAGNOSTICS <replaceable>variable</replaceable> = <replaceable>item</replaceable> <optional> , ... </optional>;
  </synopsis>
  
       This command allows retrieval of system status indicators.  Each
--- 1414,1420 ----
       command, which has the form:
  
  <synopsis>
! GET <optional> CURRENT </optional> DIAGNOSTICS <replaceable>variable</replaceable> { = | := } <replaceable>item</replaceable> <optional> , ... </optional>;
  </synopsis>
  
       This command allows retrieval of system status indicators.  Each
*************** GET <optional> CURRENT </optional> DIAGN
*** 1425,1430 ****
--- 1428,1435 ----
       <acronym>SQL</acronym> command.  Note that <varname>RESULT_OID</>
       is only useful after an <command>INSERT</command> command into a
       table containing OIDs.
+      Equals (<literal>:=</>) can be used instead of SQL-standard
+      <literal>=</> for <command>GET DIAGNOSTICS</>.
      </para>
  
      <para>
*************** SELECT merge_db(1, 'dennis');
*** 2672,2678 ****
       <command>GET STACKED DIAGNOSTICS</command> command, which has the form:
  
  <synopsis>
! GET STACKED DIAGNOSTICS <replaceable>variable</replaceable> = <replaceable>item</replaceable> <optional> , ... </optional>;
  </synopsis>
  
       Each <replaceable>item</replaceable> is a key word identifying a status
--- 2677,2683 ----
       <command>GET STACKED DIAGNOSTICS</command> command, which has the form:
  
  <synopsis>
! GET STACKED DIAGNOSTICS <replaceable>variable</replaceable> { = | := } <replaceable>item</replaceable> <optional> , ... </optional>;
  </synopsis>
  
       Each <replaceable>item</replaceable> is a key word identifying a status
*************** END;
*** 2776,2782 ****
     <para>
  
  <synopsis>
! GET <optional> CURRENT </optional> DIAGNOSTICS <replaceable>variable</replaceable> = <replaceable>PG_CONTEXT</replaceable> <optional> , ... </optional>;
  </synopsis>
  
  
--- 2781,2787 ----
     <para>
  
  <synopsis>
! GET <optional> CURRENT </optional> DIAGNOSTICS <replaceable>variable</replaceable> { = | := } <replaceable>PG_CONTEXT</replaceable> <optional> , ... </optional>;
  </synopsis>
  
  
diff --git a/src/pl/plpgsql/src/pl_gram.y b/src/pl/plpgsql/src/pl_gram.y
new file mode 100644
index 3fd6655..c0cb585
*** a/src/pl/plpgsql/src/pl_gram.y
--- b/src/pl/plpgsql/src/pl_gram.y
*************** decl_defkey		: assign_operator
*** 796,802 ****
  				| K_DEFAULT
  				;
  
! assign_operator	: '='	/* not documented because it might be removed someday */
  				| COLON_EQUALS
  				;
  
--- 796,807 ----
  				| K_DEFAULT
  				;
  
! /*
!  * 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
  				;
  


view thread (27+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: remove undocumented assign syntax from plpgsql doc
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox