Re: ExecTypeSetColNames is fundamentally broken

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: ExecTypeSetColNames is fundamentally broken
Дата
Msg-id CA+TgmoYX8ZsL5BoYeJD+QK9iCQLBdq1mbQ_ZiwZGKBwzgFZYWA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: ExecTypeSetColNames is fundamentally broken  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: ExecTypeSetColNames is fundamentally broken  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Tue, Dec 7, 2021 at 12:30 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> If we consider that the alias renames the columns "for all purposes",
> how is it okay for f() to select the "a" column?

I'd say it isn't.

> Another way to phrase the issue is that the column names seen
> by f() are currently different from those seen by row_to_json():
>
> regression=# select row_to_json(t) from t as t(x,y);
>    row_to_json
> -----------------
>  {"x":11,"y":12}
> (1 row)
>
> and that seems hard to justify.

Yeah, I agree. The problem I have here is that, with your proposed
fix, it still won't be very consistent. True, row_to_json() and f()
will both see the unaliased column names ... but a straight select *
from t as t(x,y) will show the aliased names. That's unarguably better
than corrupting your data, but it seems "astonishing" in the POLA
sense.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



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

Предыдущее
От: "Bossart, Nathan"
Дата:
Сообщение: Re: Alter all tables in schema owner fix
Следующее
От: Alexander Lakhin
Дата:
Сообщение: Re: MSVC SSL test failure