Re: Improving default column names/aliases of subscript text expressions
| От | Tom Lane |
|---|---|
| Тема | Re: Improving default column names/aliases of subscript text expressions |
| Дата | |
| Msg-id | 1997166.1734373927@sss.pgh.pa.us обсуждение |
| Ответ на | Re: Improving default column names/aliases of subscript text expressions (Jelte Fennema-Nio <postgres@jeltef.nl>) |
| Ответы |
Re: Improving default column names/aliases of subscript text expressions
|
| Список | pgsql-hackers |
Jelte Fennema-Nio <postgres@jeltef.nl> writes:
> On Mon, 16 Dec 2024 at 16:34, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> View definition:
>> SELECT data['a'::text] AS data
>> FROM tj;
> Are you sure you ran this with my patch?
No, sorry, I was just illustrating the behavior with HEAD.
The important part of this is not the assigned alias
but the visible cast.
>> regression=# select data['2'], data[3] from t2;
>> data | data
>> ------+------
>> 2 | 3
>> (1 row)
> So what would you want here? Do you want these columns to be called 2
> and 3?
No!!
> One thing that I didn't see you explicitly say: Do you agree that the
> new column names are actually better than the old ones?
No, I'm not at all convinced of that. For these examples
I'd prefer something like "data_a", "data_b", etc.
That approach might also make it more palatable to process integer
literals this way (i.e. "data_2" etc), though I am not sure we want
to do that because of the increased blast radius.
regards, tom lane
В списке pgsql-hackers по дате отправления: