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 1swN6S-003QWf-G8 for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Oct 2024 14:46:53 +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 1swN6R-00GUo7-1T for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Oct 2024 14:46:51 +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 1swN6Q-00GUnx-Np for pgsql-hackers@lists.postgresql.org; Thu, 03 Oct 2024 14:46:50 +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 1swN6M-002Mag-Rz for pgsql-hackers@postgresql.org; Thu, 03 Oct 2024 14:46:50 +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 493EkkQM304681; Thu, 3 Oct 2024 10:46:46 -0400 From: Tom Lane To: jian he cc: PostgreSQL-development Subject: Re: make \d table Collation field showing domains collation if that attribute is type of domain. In-reply-to: References: Comments: In-reply-to jian he message dated "Thu, 03 Oct 2024 22:16:00 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <304679.1727966805.1@sss.pgh.pa.us> Date: Thu, 03 Oct 2024 10:46:46 -0400 Message-ID: <304680.1727966806@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk jian he writes: > main changes: > @@ -1866,7 +1866,7 @@ describeOneTableDetails(const char *schemaname, > attrdef_col = cols++; > attnotnull_col = cols++; > appendPQExpBufferStr(&buf, ",\n (SELECT c.collname > FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n" > - " WHERE > c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> > t.typcollation) AS attcollation"); > + " WHERE > c.oid = a.attcollation AND t.oid = a.atttypid and c.collname <> > 'default' ) AS attcollation"); I doubt that this is an improvement. It will create as many weird cases as it removes. (To cite just one, there is nothing preventing somebody from creating a collation named "default".) The existing definition seems fine to me, anyway. What's so wrong with treating the domain's collation as being an implicit property of the domain type? What you want to do hopelessly confuses this display between attributes of the table and attributes of the column type. A nearby comparable case is that the "Default" column only tells about default values applied in the table definition, not any that might have come from the domain. Nor does the "Check constraints" footer tell about constraints coming from a domain column. regards, tom lane