Thread: Colon Omitted From pgSQL Assignments

Colon Omitted From pgSQL Assignments

From
Charles Sheridan
Date:
Hi,

I was looking at PL/pgSQL documentation and realized that contrary to
spec, I've been omitting the colon ':' from assignments, e.g. writing
  'x  = 5' rather than the correct  'x := 5'

I don't see any error messages about this.

I am not aware of any problems due to this.  I suppose that if a
condition precedes this syntax, the code could be interpreted as an
equals test.

Should I immediately update all assignments ?

Are there known scenarios where this error becomes a problem ?

Regards, Charles






Re: Colon Omitted From pgSQL Assignments

From
Pavel Stehule
Date:
Hi



2015-08-18 17:41 GMT+02:00 Charles Sheridan <cesheri@swbell.net>:
Hi,

I was looking at PL/pgSQL documentation and realized that contrary to
spec, I've been omitting the colon ':' from assignments, e.g. writing

  'x  = 5' rather than the correct
  'x := 5'

I don't see any error messages about this.

this is undocumented feature, that should not be removed due possible compatibility issues.

see comments from gram.y

 * 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 :=.

Personally I am thinking, so this design is unhappy, but at the end this is small problem not too important to solve.

Regards

Pavel

 

I am not aware of any problems due to this.  I suppose that if a
condition precedes this syntax, the code could be interpreted as an
equals test.

Should I immediately update all assignments ?

Are there known scenarios where this error becomes a problem ?

Regards, Charles





--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers