Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W3TOr-0003O1-E2 for pgsql-docs@arkaria.postgresql.org; Wed, 15 Jan 2014 16:33:05 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W3TOq-0001TA-TQ for pgsql-docs@arkaria.postgresql.org; Wed, 15 Jan 2014 16:33:04 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W3TOq-0001Sy-60 for pgsql-docs@postgresql.org; Wed, 15 Jan 2014 16:33:04 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W3TOm-00020D-Ne for pgsql-docs@postgresql.org; Wed, 15 Jan 2014 16:33:03 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1W3TOl-0005rU-Hw; Wed, 15 Jan 2014 11:32:59 -0500 Date: Wed, 15 Jan 2014 11:32:59 -0500 From: Bruce Momjian To: Pavel Stehule Cc: Tom Lane , pgsql-docs Subject: Re: remove undocumented assign syntax from plpgsql doc Message-ID: <20140115163259.GA12704@momjian.us> References: <20140112042306.GM28089@momjian.us> <20140113025904.GB22464@momjian.us> <20140113140433.GA7868@momjian.us> <20140114202128.GA7761@momjian.us> <20140115153535.GA7607@momjian.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="a8Wt8u1KmwUX3Y2C" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + --a8Wt8u1KmwUX3Y2C Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="assign.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 **** The general syntax of a variable declaration is: ! name CONSTANT type COLLATE collation_name NOT NULL { DEFAULT | := } expression ; The DEFAULT clause, if given, specifies the initial value assigned to the variable when the block is entered. If the DEFAULT clause --- 328,334 ---- The general syntax of a variable declaration is: ! name CONSTANT type COLLATE collation_name NOT NULL { DEFAULT | := | = } expression ; The DEFAULT clause, if given, specifies the initial value assigned to the variable when the block is entered. If the 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 NOT NULL must have a nonnull default value specified. + Equals (=) can be used instead of PL/SQL-compliant + :=. *************** PREPARE statement_name(i *** 866,872 **** An assignment of a value to a PL/pgSQL variable is written as: ! variable := expression; As explained previously, the expression in such a statement is evaluated by means of an SQL SELECT command sent to the main --- 868,874 ---- An assignment of a value to a PL/pgSQL variable is written as: ! variable { := | = } expression; As explained previously, the expression in such a statement is evaluated by means of an SQL SELECT command sent to the main *************** PREPARE 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. --- 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 (=) can be ! used instead of PL/SQL-compliant :=. *************** EXECUTE format('UPDATE tbl SET %I = $1 W *** 1411,1417 **** command, which has the form: ! GET CURRENT DIAGNOSTICS variable = item , ... ; This command allows retrieval of system status indicators. Each --- 1414,1420 ---- command, which has the form: ! GET CURRENT DIAGNOSTICS variable { = | := } item , ... ; This command allows retrieval of system status indicators. Each *************** GET CURRENT DIAGN *** 1425,1430 **** --- 1428,1435 ---- SQL command. Note that RESULT_OID is only useful after an INSERT command into a table containing OIDs. + Equals (:=) can be used instead of SQL-standard + = for GET DIAGNOSTICS. *************** SELECT merge_db(1, 'dennis'); *** 2672,2678 **** GET STACKED DIAGNOSTICS command, which has the form: ! GET STACKED DIAGNOSTICS variable = item , ... ; Each item is a key word identifying a status --- 2677,2683 ---- GET STACKED DIAGNOSTICS command, which has the form: ! GET STACKED DIAGNOSTICS variable { = | := } item , ... ; Each item is a key word identifying a status *************** END; *** 2776,2782 **** ! GET CURRENT DIAGNOSTICS variable = PG_CONTEXT , ... ; --- 2781,2787 ---- ! GET CURRENT DIAGNOSTICS variable { = | := } PG_CONTEXT , ... ; 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 ; --a8Wt8u1KmwUX3Y2C Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs --a8Wt8u1KmwUX3Y2C--