plpgsql variable named as SQL keyword

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: plpgsql variable named as SQL keyword
Date: 2019-02-28 17:45:23
Message-ID: CAFj8pRDSQ7G97WVA=bzC9JG_jK+80y2t=bUjH44AK6b05fs_Wg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

one user of plpgsql_check reported interesting error message

create or replace function omega.foo(a int)
returns int as $$
declare offset integer := 0;
begin
return offset + 1;
end;
$$ language plpgsql;

postgres=# select omega.foo(10);
ERROR: query "SELECT offset + 1" returned 0 columns
CONTEXT: PL/pgSQL function omega.foo(integer) line 4 at RETURN

Maybe we should to disallow variables named as sql reserved keyword.

Regards

Pavel

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shawn Debnath 2019-02-28 18:02:46 Re: Drop type "smgr"?
Previous Message Tom Lane 2019-02-28 17:39:04 Re: Drop type "smgr"?