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 1w7BAg-0052Q9-33 for pgsql-bugs@arkaria.postgresql.org; Mon, 30 Mar 2026 11:52:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7BAf-002yUd-1E for pgsql-bugs@arkaria.postgresql.org; Mon, 30 Mar 2026 11:52:41 +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.96) (envelope-from ) id 1w733s-000gGb-0W for pgsql-bugs@lists.postgresql.org; Mon, 30 Mar 2026 03:13:08 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w733p-00000001vLe-45Vy for pgsql-bugs@lists.postgresql.org; Mon, 30 Mar 2026 03:13:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=aEjkhTBKsOiTeP4W7nkhmADnc+ikKQ1kLH2gDy5RXTk=; b=GlGPW3GI253KUL0OBNXv+MGkzl Nk+rSsLzlsRRnDBAGkRinKayh8z8j51NV2ceH+2GKQhz2KtCbxXVvq2xJjJBIOoOztjmnmuhnhoXE 7WykXUSrmsDpQqPpLnN2wSniE+zS9vgjfYfnPwX+AHDsmjT1uriU9+bNK6/PtRfiUOxJoGaFp3FU5 XE/4c83x2qB28cdRzcz6InmVZX8Klb0emN9a2iINonPgz7qcp9yTB4CF19aJPgJkHXFFDbgOpRCe0 k5Nl4CgpLJ9UDPNFRbXb/ht8bBB2xE1r0JpF0vQLl9N7u/ZdpPt5e+4hOEpm8dFgsLskTQnOUQPEr 00LU6rBQ==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w733o-006ZCy-2N for pgsql-bugs@lists.postgresql.org; Mon, 30 Mar 2026 03:13:05 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w733m-00ADaR-2O for pgsql-bugs@lists.postgresql.org; Mon, 30 Mar 2026 03:13:03 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19446: Domain DEFAULT not reflected in system catalogs and information_schema (PG 18.3) To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: zheng_xianghang@163.com Reply-To: zheng_xianghang@163.com, pgsql-bugs@lists.postgresql.org Date: Mon, 30 Mar 2026 03:12:10 +0000 Message-ID: <19446-c2e092abdbf0216e@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The following bug has been logged on the website: Bug reference: 19446 Logged by: Xianghang Zheng Email address: zheng_xianghang@163.com PostgreSQL version: 18.3 Operating system: Linux x86_64 Description: =20 1. PostgreSQL Version PostgreSQL 18.3 (x86_64) 2. Operating System Linux x86_64 3. Problem Description When a column uses a domain with DEFAULT value, all system catalogs fail to reflect the default: - pg_attribute.atthasdef =3D false - No entries in pg_attrdef - information_schema.columns.column_default is empty But the default value works correctly at runtime. This is a metadata bug. 4. Steps to Reproduce CREATE DOMAIN info_domain AS int DEFAULT 100; CREATE TABLE t (col info_domain); SELECT attname, atthasdef FROM pg_attribute WHERE attrelid =3D 't'::regclass AND attnum > 0; SELECT * FROM pg_attrdef WHERE adrelid =3D 't'::regclass; SELECT column_name, column_default FROM information_schema.columns WHERE table_name =3D 't' AND column_name =3D 'col'; INSERT INTO t DEFAULT VALUES; SELECT * FROM t; 5. Actual Result - atthasdef =3D f - pg_attrdef returns empty - column_default is empty - But the default value 100 works 6. Expected Result System catalogs should show the domain's DEFAULT correctly. 7. Test Output postgres=3D# CREATE DOMAIN info_domain AS int DEFAULT 100; CREATE DOMAIN postgres=3D# CREATE TABLE t (col info_domain); CREATE TABLE postgres=3D# SELECT attname, atthasdef FROM pg_attribute WHERE attrelid =3D 't'::regclass AND attnum > 0; attname | atthasdef ---------+----------- col | f (1 row) postgres=3D# SELECT * FROM pg_attrdef WHERE adrelid =3D 't'::regclass; oid | adrelid | adnum | adbin -----+---------+-------+------- (0 rows) postgres=3D# SELECT column_name, column_default FROM information_schema.columns WHERE table_name =3D 't' AND column_name =3D 'co= l'; column_name | column_default -------------+---------------- col | (1 row) postgres=3D# INSERT INTO t DEFAULT VALUES; INSERT 0 1 postgres=3D# SELECT * FROM t; col ----- 100 (1 row)