Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rk2yT-009tlv-Oq for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Mar 2024 14:19:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rk2yS-00DSx5-0V for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Mar 2024 14:19:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rk2yR-00DSwx-NG for pgsql-hackers@lists.postgresql.org; Tue, 12 Mar 2024 14:19:24 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rk2yP-0047nZ-JI for pgsql-hackers@lists.postgresql.org; Tue, 12 Mar 2024 14:19:23 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 42CEJCA71670514; Tue, 12 Mar 2024 10:19:12 -0400 From: Tom Lane To: "David G. Johnston" cc: "adjkldd@126.com" , "pgsql-hackers@lists.postgresql.org" Subject: Re: confusing `case when` column name In-reply-to: References: <336abc39.8084.18e32ad7ffc.Coremail.winterloo@126.com> Comments: In-reply-to "David G. Johnston" message dated "Tue, 12 Mar 2024 06:27:31 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1670512.1710253152.1@sss.pgh.pa.us> Date: Tue, 12 Mar 2024 10:19:12 -0400 Message-ID: <1670513.1710253152@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > On Tuesday, March 12, 2024, adjkldd@126.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