Jelte Fennema-Nio <postg...@jeltef.nl> writes:
> On Mon, 16 Dec 2024 at 16:34, Tom Lane <t...@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


Reply via email to