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 1w2a8r-000Px2-0k for pgsql-general@arkaria.postgresql.org; Tue, 17 Mar 2026 19:31:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2a8q-004Og4-0O for pgsql-general@arkaria.postgresql.org; Tue, 17 Mar 2026 19:31:48 +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 1w2a8p-004Ofv-0n for pgsql-general@lists.postgresql.org; Tue, 17 Mar 2026 19:31:47 +0000 Received: from fout-a5-smtp.messagingengine.com ([103.168.172.148]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w2a8l-00000000Et2-39eo for pgsql-general@postgresql.org; Tue, 17 Mar 2026 19:31:46 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id 61A6DEC01C0 for ; Tue, 17 Mar 2026 15:31:44 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Tue, 17 Mar 2026 15:31:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to; s=fm3; t=1773775904; x=1773862304; bh=ar1wAPA6qL l/J4SUzL2LIg9EN5uVZVWXiYHo2dYvYSk=; b=mWfE0QbvGWyxxRquRAzkRDgv1Z IN11/olHXUXiCwMNDPWqdsr3WLt78gSnzRXoGE0tVqaxEXKpChDb0/wilVEwWxoL gBqF1mmD/OnmjezCjQT7K9sYBnGokgaaADCbnpUKetZyL0ctqbPRaDWrqsKFvvdA tg1KwbeGnJ7AcH2142NTtfslUokl1oUjYz1CFCpOymotecPEXO20wp4JyY8sVJtk kGOD2/1pDLNP5ndHZmpA1j4MiERxXDL64tiW6yiQ7pg9rq8002ybMdq04KMkmM/1 pS+wa0Tfn2Fy63AK3F6+sDKndHVtKXz9MCBDLW6ndREusZY8GVyGDyrshahg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1773775904; x=1773862304; bh=ar1wAPA6qLl/J4SUzL2LIg9EN5uVZVWXiYH o2dYvYSk=; b=rkop5oaCIYaPwF+VsmrKF/tqwA3o02G0/UBPCs2+WsDryoqSWtD SIAZ6NVc2IK4kCBSQuwJqkbcleiasy5zaB8aH8yQPMwGK6aL50HXsbCW2DPMZawS B5xQoq/AovKpEwtD9OK6nz7+Ofr9nCqnBoNfVjVuSOPzmPg7tVwZnsLKnzIpRI5z i8ZPvebKvPZ3ua0SPtQQqHOyjH/L8zB47R9d/hb8wMFAD8ol9GEA3cGy5aOwHjgW j2hjUdoTC1WrB5tI6FZRhI5sykuZxftqU5blnbrTYi0gnf3KUhMHujkyh5/yCGdK +um/62WeWicYjEEp4BJ5BRLhyyD6UgN3WFg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdeftddvuddtucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfvhffutgfgsehtjeertddtvd ejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgv rhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnheptedtvdejhfffgfektd eutdejieethfffteevieekkedvudeuudekueehfffhkeeknecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrg hklhgrvhgvrhdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhht pdhrtghpthhtohepphhgshhqlhdqghgvnhgvrhgrlhesphhoshhtghhrvghsqhhlrdhorh hg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 17 Mar 2026 15:31:43 -0400 (EDT) Message-ID: Date: Tue, 17 Mar 2026 12:31:43 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: pgsql-general From: Adrian Klaver Subject: Trying to understand pg_get_expr() Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Given: select version(); version ----------------------------------------------- PostgreSQL 17.9 (Ubuntu 17.9-1.pgdg24.04+1) and: CREATE TABLE default_test ( id integer, fld_1 varchar DEFAULT 'test', fld_2 integer DEFAULT 0 ); Then: SELECT adrelid::regclass, pg_typeof(pg_get_expr(adbin, adrelid)), pg_get_expr(adbin, adrelid) FROM pg_attrdef WHERE adrelid = 'default_test'::regclass; adrelid | pg_typeof | pg_get_expr --------------+-----------+--------------------------- default_test | text | 'test'::character varying default_test | text | 0 and: SELECT adrelid::regclass, pg_typeof(pg_get_expr(adbin, adrelid)), pg_get_expr(adbin, adrelid) FROM pg_attrdef WHERE adrelid = 'default_test'::regclass AND pg_get_expr(adbin, adrelid) = '0'; adrelid | pg_typeof | pg_get_expr --------------+-----------+------------- default_test | text | 0 SELECT adrelid::regclass, pg_typeof(pg_get_expr(adbin, adrelid)), pg_get_expr(adbin, adrelid) FROM pg_attrdef WHERE adrelid = 'default_test'::regclass AND pg_get_expr(adbin, adrelid) = 'test'; adrelid | pg_typeof | pg_get_expr ---------+-----------+------------- (0 rows) Why does the = 'test' not return anything? -- Adrian Klaver adrian.klaver@aklaver.com