Re: grouping treated as keyword in function return table

Поиск
Список
Период
Сортировка
От Mike Porter
Тема Re: grouping treated as keyword in function return table
Дата
Msg-id alpine.OSX.2.20.1607121225380.45959@qbp.aff.hqry.rqh
обсуждение исходный текст
Ответ на Re: grouping treated as keyword in function return table  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: grouping treated as keyword in function return table  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Tue, 12 Jul 2016, Tom Lane wrote:

> Mike Porter <mike@udel.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
charactervarying DEFAULT NULL::character varying, a_nssid integer DEFAULT NULL::integer) RETURNS TABLE(nssid integer,
alphanamecharacter 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_idinteger, common character varying, multivalue boolean, common_cmt character varying, attribute_id integer,
valuecharacter 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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: grouping treated as keyword in function return table
Следующее
От: Tom Lane
Дата:
Сообщение: Re: grouping treated as keyword in function return table