Re: confusing `case when` column name

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "adjkldd(at)126(dot)com" <winterloo(at)126(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: confusing `case when` column name
Date: 2024-03-12 14:19:12
Message-ID: 1670513.1710253152@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Tuesday, March 12, 2024, adjkldd(at)126(dot)com <winterloo(at)126(dot)com> wrote:
>> Nee we change the title of the case-when output column?

> Choosing either a or b as the label seems wrong and probably worth changing
> to something that has no meaning and encourages the application of a column
> alias.

Yeah, we won't get any kudos for changing a rule that's stood for
25 years, even if it's not very good. This is one of the places
where it's just hard to make a great choice automatically, and
users are probably going to end up applying an AS clause most of
the time if they care about the column name at all.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2024-03-12 14:27:48 Re: On disable_cost
Previous Message Jelte Fennema-Nio 2024-03-12 14:04:21 Re: [EXTERNAL] Re: Add non-blocking version of PQcancel