Re: Colon Omitted From pgSQL Assignments

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Charles Sheridan <cesheri(at)swbell(dot)net>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Colon Omitted From pgSQL Assignments
Date: 2015-08-18 15:48:43
Message-ID: CAFj8pRCYZvpXjEvhpzx5sSFqH2_G+_i+Jr_JwLhkLr-Qczb93Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

2015-08-18 17:41 GMT+02:00 Charles Sheridan <cesheri(at)swbell(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2015-08-18 15:54:07 Re: Test code is worth the space
Previous Message Charles Sheridan 2015-08-18 15:41:31 Colon Omitted From pgSQL Assignments