Re: grouping treated as keyword in function return table

From: Mike Porter <mike(at)udel(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: grouping treated as keyword in function return table
Date: 2016-07-12 16:44:50
Message-ID: alpine.OSX.2.20.1607121225380.45959@qbp.aff.hqry.rqh
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, 12 Jul 2016, Tom Lane wrote:

> Mike Porter <mike(at)udel(dot)edu> writes:
>> Postgres 9.5.3 built from source. However, I think this has been
>> happening for a long time.
>
> Only since 9.5, because GROUPING wasn't a keyword before that.
>
>> 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.
>
> This is expected given that it's now partially reserved.

Perhaps it was in an earlier 9.5 test when I added the quotes...

I noticed that grouping is fully quoted in all the tables in the
dump. Will grouping be a fully reserved word at some point?

>
>> Additionally, pg_dumpall does not quote grouping when dumping
>> the function so the function will not be restored when the dump is
>> loaded.
>
> That would be a pg_dump bug, but it doesn't happen for me: I get
>
> CREATE FUNCTION a() RETURNS TABLE("grouping" integer)
> LANGUAGE sql
> AS $$ select 1; $$;
>
> Sure you're using 9.5 pg_dump?

My notes say so.

/usr/local/postgresql-9.5.3/bin/pg_dumpall -h a.server -U postgres > 9.5.3.sql

From the dump:

--
-- Name: find_attributes_source(character varying, character varying, integer); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION find_attributes_source(a_alphaname character varying DEFAULT NULL::character varying, a_emplid character varying DEFAULT NULL::character varying, a_nssid integer DEFAULT NULL::integer) RETURNS TABLE(nssid integer, alphaname character varying, emplid character varying, grouping_id integer, grouping character varying, programatic boolean, g_cmt character varying, priority integer, acon_id integer, acon character varying, acon_cmt character varying, common_id integer, common character varying, multivalue boolean, common_cmt character varying, attribute_id integer, value character varying, attribute_cmt character varying)
LANGUAGE sql STABLE COST 50 ROWS 50
AS $_$

=> /usr/local/postgresql-9.5.3/bin/pg_dumpall -V
pg_dumpall (PostgreSQL) 9.5.3

The source database on "a.server" is 9.3.5.

>
> regards, tom lane

Thanks,

Mike

>

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2016-07-12 16:58:20 Re: grouping treated as keyword in function return table
Previous Message Tom Lane 2016-07-12 16:06:12 Re: grouping treated as keyword in function return table