grouping treated as keyword in function return table

From: Mike Porter <mike(at)udel(dot)edu>
To: pgsql-bugs(at)postgresql(dot)org
Subject: grouping treated as keyword in function return table
Date: 2016-07-12 15:51:05
Message-ID: alpine.OSX.2.20.1607121145281.45959@qbp.aff.hqry.rqh
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Postgres 9.5.3 built from source. However, I think this has been
happening for a long time.

create function a() returns table( grouping integer ) language sql as $$
select 1;
$$;
ERROR: syntax error at or near "grouping"
LINE 1: create function a() returns table( grouping integer ) langua...

If we quote "grouping"
^
create function a() returns table( "grouping" integer ) language sql as $$
select 1;
$$
;
CREATE FUNCTION

grouping is a valid column in a table and does not need to be quoted:

create temp table test( grouping integer );
CREATE TABLE

So, in almost all cases grouping is not required to be quoted,
however when used in a table defined as a function return type, it
is. Additionally, pg_dumpall does not quote grouping when dumping
the function so the function will not be restored when the dump is
loaded.

Thanks,

Mike

-
Mike Porter
PGP Fingerprint: F4 AE E1 9F 67 F7 DA EA 2F D2 37 F3 99 ED D1 C2

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2016-07-12 16:06:12 Re: grouping treated as keyword in function return table
Previous Message Amit Kapila 2016-07-12 14:09:31 Re: BUG #14243: pg_basebackup failes by a STATUS_DELETE_PENDING file