čt 28. 2. 2019 v 19:20 odesílatel Tom Lane <t...@sss.pgh.pa.us> napsal:

> Pavel Stehule <pavel.steh...@gmail.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
>

Reply via email to