grouping treated as keyword in function return table - Mailing list pgsql-bugs

From Mike Porter
Subject grouping treated as keyword in function return table
Date
Msg-id alpine.OSX.2.20.1607121145281.45959@qbp.aff.hqry.rqh
Whole thread Raw
Responses Re: grouping treated as keyword in function return table
List 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

pgsql-bugs by date:

Previous
From: Amit Kapila
Date:
Subject: Re: BUG #14243: pg_basebackup failes by a STATUS_DELETE_PENDING file
Next
From: Tom Lane
Date:
Subject: Re: grouping treated as keyword in function return table