Re: Improving inferred query column names

Поиск
Список
Период
Сортировка
От Vladimir Churyukin
Тема Re: Improving inferred query column names
Дата
Msg-id CAFSGpE1bR1om63nxjdyyec-ksbfSt8eDWi2_7Bk1e1ArE_qxfA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Improving inferred query column names  (Andres Freund <andres@anarazel.de>)
Ответы Re: Improving inferred query column names  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers


On Wed, Feb 22, 2023, 12:40 PM Andres Freund <andres@anarazel.de> wrote:
Hi,

On 2023-02-11 12:47:04 -0800, Vladimir Churyukin wrote:
> That is a good idea for simple cases, I'm just curious how it would look
> like for more complex cases (you can have all kinds of expressions as
> parameters for aggregate function calls).
> If it works only for simple cases, I think it would be confusing and not
> very helpful.

I don't think it needs to be perfect to be helpful.


It doesn't need to be perfect, but it needs to be consistent. So far you proposed a rule to replace () with _. What is the plan for expressions, how to convert them to names (with deduplication I guess?, because there could be 2 similar expressions mapped to the same name potentially).


> Wouldn't it make more sense to just deduplicate the names by adding
> numerical postfixes, like sum_1, sum_2?

That'd be considerably worse than what we do today imo, because any reordering
/ added aggregate would lead to everything else changing as well.


Ok, that I kinda agree with. Not necessarily worse overall, but worse for some cases. Well, the proposal above about keeping the names exactly the same as the full expressions is probably the best we can do then. It will take care of possible duplications and won't be position-sensitive. And will be consistent. The only issue is somewhat unusual column names that you will have to use quotes to refer to. But is that a real issue?

-Vladimir Churyukin

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

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: Add SHELL_EXIT_CODE to psql
Следующее
От: Melanie Plageman
Дата:
Сообщение: Re: Option to not use ringbuffer in VACUUM, using it in failsafe mode