From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Bruce Momjian <bruce(at)momjian(dot)us> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-docs <pgsql-docs(at)postgresql(dot)org> |
Subject: | Re: remove undocumented assign syntax from plpgsql doc |
Date: | 2014-01-12 06:00:09 |
Message-ID: | CAFj8pRAyAOi9ZJbxMBPkW+r03n+zQm6idojWWH2n17h8NGyXBA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
2014/1/12 Bruce Momjian <bruce(at)momjian(dot)us>
> On Sat, Jan 11, 2014 at 10:06:27PM +0100, Pavel Stehule wrote:
> >
> >
> >
> > 2014/1/11 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> >
> > Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > > Oh, I think you are right. I have reverted the patch. Attached is
> > > proposed documentation for '='.
> >
> > Meh. Variable initialization is only one of multiple cases
> (assignment,
> > GET DIAGNOSTICS; maybe others, I've not examined the grammar). Also,
> > if we do it like this, we're implying that both := and = are equally
> > preferred, which might not be the impression we want to leave.
> >
> >
> > GET DIAGNOSTICS is defined by standard - and there "=" should be allowed
> only -
> > although we allow ":=" too. It is a embedded SQL statement - although it
> is
> > implemented as plpgsql statement.
>
> OK, docs updated for that. I assume OPEN and FOR also can take := or =,
> right?
>
> > Same situation is with UPDATE statement - we don't allow ":=" there.
> >
> >
> >
> > I'd be a bit inclined to just stick a NOTE somewhere saying that "="
> > can be used in place of ":=" for assignment.
> >
> >
> > ok
> >
> > If we accept it and we close this topic, then following comment should be
> > removed
> >
> > assign_operator : '=' /* not documented because it might be removed
> someday *
>
> Comment updated. Patch attached.
>
>
Still I am missing message about preferred syntax (or we should to enhance
GET DIAGNOSTICS doc about proprietary syntax).
PL/pgSQL, PL/SQL is mix of two languages: ADA and SQL - and their designers
decided so embedded SQL statements will be placed in native SQL syntax (and
ADA in simplified ADA syntax)
We have to find a agreement what we will prefer for PL/pgSQL:
The assign statement is "ADA" statement - ":=" is preferred
The GET DIAGNOSTICS is "SQL" statement - "=" is preferred
A newer SQL/PSM was designed differently - without this dichotomy - A
assignment is emphased by syntax SET varname = value
A proper syntax is good information what is coming from - and It is good
mental helper to understand a philosophy of stored procedures (that shares
concepts with PL/SQL). Next argument is similarity with PL/SQL and SQL PL.
This statement (GET DIAGNOSTICS) is supported on both environments and only
"=" is allowed there.
Regards
Pavel
> --
> Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
> EnterpriseDB http://enterprisedb.com
>
> + Everyone has their own god. +
>
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2014-01-13 02:48:46 | Re: remove undocumented assign syntax from plpgsql doc |
Previous Message | Pavel Stehule | 2014-01-12 05:38:04 | Re: remove undocumented assign syntax from plpgsql doc |