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.96) (envelope-from ) id 1w7HgB-00597b-32 for pgsql-bugs@arkaria.postgresql.org; Mon, 30 Mar 2026 18:49:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7HgA-005cLe-0o for pgsql-bugs@arkaria.postgresql.org; Mon, 30 Mar 2026 18:49:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w7HgA-005cLW-01 for pgsql-bugs@lists.postgresql.org; Mon, 30 Mar 2026 18:49:38 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w7Hg8-00000001qmW-2if8 for pgsql-bugs@lists.postgresql.org; Mon, 30 Mar 2026 18:49:37 +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 62UInUCE2544066; Mon, 30 Mar 2026 14:49:31 -0400 From: Tom Lane To: zheng_xianghang@163.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19445: Domain DEFAULT not recorded in pg_attrdef (atthasdef false) in PostgreSQL 18.3 In-reply-to: <19445-f919d77c0e4f8d10@postgresql.org> References: <19445-f919d77c0e4f8d10@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Mon, 30 Mar 2026 03:11:35 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2544064.1774896570.1@sss.pgh.pa.us> Date: Mon, 30 Mar 2026 14:49:30 -0400 Message-ID: <2544065.1774896570@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > When a table column uses a domain that has a DEFAULT value, the column's > pg_attribute.atthasdef is false, and no entry exists in pg_attrdef. > However, the domain default value works correctly at runtime. > This is a system catalog metadata bug. No, it is not, as demonstrated by the fact that the behavior is correct. There is no default expression associated directly with the table column, therefore it's correct that atthasdef is false. If we did store a default there, that would be equivalent to a case like CREATE DOMAIN my_arr_domain AS int[] DEFAULT '{}'; CREATE TABLE t (col my_arr_domain DEFAULT '{}'); The problem with this is that the column-associated default would override the domain-associated default, so that the column's behavior would fail to track ALTER DOMAIN SET DEFAULT. So the change you are proposing would create a bug not fix one. regards, tom lane