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 1sMcDl-003Mjm-L8 for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Jun 2024 23:38:37 +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 1sMcDi-0072nY-IU for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Jun 2024 23:38:34 +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 1sMcDi-0072nQ-8q for pgsql-hackers@lists.postgresql.org; Wed, 26 Jun 2024 23:38:34 +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 1sMcDb-003j88-SK for pgsql-hackers@postgresql.org; Wed, 26 Jun 2024 23:38:33 +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 45QNcPDf1639493; Wed, 26 Jun 2024 19:38:25 -0400 From: Tom Lane To: David Rowley cc: "David G. Johnston" , James Coleman , pgsql-hackers Subject: Re: Should we document how column DEFAULT expressions work? In-reply-to: References: <1362410.1719349169@sss.pgh.pa.us> <1390099.1719357084@sss.pgh.pa.us> <1437009.1719378777@sss.pgh.pa.us> Comments: In-reply-to David Rowley message dated "Thu, 27 Jun 2024 11:19:38 +1200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1639491.1719445105.1@sss.pgh.pa.us> Date: Wed, 26 Jun 2024 19:38:25 -0400 Message-ID: <1639492.1719445105@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk David Rowley writes: > On Wed, 26 Jun 2024 at 17:12, Tom Lane wrote: >> Do we want to do anything about >> nextval()? I guess if you hold your head at the correct >> angle, that's also a magic-input-value issue, in the sense >> that the question is when does regclass input get resolved. > I think I'm not understanding what's special about that. Aren't > 'now'::timestamp and 'seq_name'::regclass are just casts that are > evaluated during parse time in transformExpr()? Right. But there is an example in the manual explaining how these two things act differently: 'seq_name'::regclass 'seq_name'::text::regclass The latter produces a constant of type text with a run-time cast to regclass (and hence a run-time pg_class lookup). IIRC, we document that mainly because the latter provides a way to duplicate nextval()'s old behavior of run-time lookup. Now that I think about it, there's a very parallel difference in the behavior of 'now'::timestamp 'now'::text::timestamp but I doubt that that example is shown anywhere. regards, tom lane