From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: plpgsql variable named as SQL keyword |
Date: | 2019-02-28 18:25:20 |
Message-ID: | CAFj8pRBdi_13=cRfrBLPQL_nodXPADeE0x4m6fFbPLX4prEP+w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
čt 28. 2. 2019 v 19:20 odesílatel Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> napsal:
> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
> > Maybe we should to disallow variables named as sql reserved keyword.
>
> That would just break existing code. There are lots of other
> examples where you can get away with such things.
>
> We've expended quite a lot of sweat to avoid reserving more names than
> we had to in plpgsql. I'm disinclined to throw that away just because
> somebody found an error message confusing. It's not like reserving
> "offset" would cause this case to work.
>
partially I solved it with new warning in plpgsql_check
https://github.com/okbob/plpgsql_check/commit/5b9ef57d570c1d11fb92b9cff76655a03767f662
postgres=# select * from plpgsql_check_function('omega.foo(int, int,
int)');
+-------------------------------------------------------------------------------+
|
plpgsql_check_function |
+-------------------------------------------------------------------------------+
| warning:00000:3:statement block:name of variable "offset" is reserved
keyword |
| Detail: The reserved keyword was used as variable
name. |
| error:42601:4:RETURN:query "SELECT offset + 1" returned 0
columns |
+-------------------------------------------------------------------------------+
(3 rows)
I understand so it has not simple solution (or had not solution). I
reported it +/- for record.
Thank you for reply
Pavel
> regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | Perumal Raj | 2019-02-28 18:26:53 | Re: Question about pg_upgrade from 9.2 to X.X |
Previous Message | Andres Freund | 2019-02-28 18:24:16 | Re: Drop type "smgr"? |