public inbox for [email protected]  
help / color / mirror / Atom feed
From: [email protected] <[email protected]>
To: [email protected]
Subject: confusing `case when` column name
Date: Tue, 12 Mar 2024 20:40:15 +0800 (CST)
Message-ID: <[email protected]> (raw)

Hi hackers,

Below is a `case when` demo,

```sql
create table foo(a int, b int);
insert into foo values (1, 2);
select case 1 when 1 then a else b end from foo;
```


Currently, psql output is,


```text
 b
---
 1
(1 row)
```


At the first glance at the output column title, I assume the result of the sql is wrong. It should be `a`.
After some investigation, I discovered that the result's value is accurate. However, PostgreSQL utilizes b as the title for the output column.
Nee we change the title of the case-when output column? If you hackers think it's worth the effort, I'm willing to invest time in working on it.
Best Regards,
Winter Loo

view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: confusing `case when` column name
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox