Re: autogenerated column names + views are a dump hazard

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: autogenerated column names + views are a dump hazard
Дата
Msg-id 11719.1425331973@sss.pgh.pa.us
обсуждение исходный текст
Ответ на autogenerated column names + views are a dump hazard  (Andres Freund <andres@2ndquadrant.com>)
Ответы Re: autogenerated column names + views are a dump hazard  (Andres Freund <andres@2ndquadrant.com>)
Re: autogenerated column names + views are a dump hazard  (Andres Freund <andres@2ndquadrant.com>)
Список pgsql-hackers
Andres Freund <andres@2ndquadrant.com> writes:
> CREATE VIEW v_03 AS
> SELECT * FROM (SELECT '2' ORDER BY 1) s;

> View definition:
>  SELECT s."?column?"
>    FROM ( SELECT '2'::text
>           ORDER BY '2'::text) s;

> Note the added cast to determine the type of the expression and the
> generated column name.

Meh.

> The easiest way to solve this would teach ruleutils.c to simply always
> attach AS clauses for auto-generated columnnames. Won't look too pretty
> though. Does somebody have a better idea?

No, it would look awful :-(.  But I think we might have enough
infrastructure in there to notice whether the column is actually
referenced or not.  So we could label the columns only if necessary,
which would at least limit the ugliness.

Another idea would be to reconsider whether we need to force display
of the cast, though I'm a bit worried about the possible side-effects.
        regards, tom lane



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Why are json <=> jsonb casts marked as explicit-only?
Следующее
От: Robert Haas
Дата:
Сообщение: Re: How about to have relnamespace and relrole?