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 1wfJ76-005Ntv-1g for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Jul 2026 15:14:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wfJ73-0025nN-3B for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Jul 2026 15:14:01 +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 1wfJ72-0025nF-2w for pgsql-hackers@lists.postgresql.org; Thu, 02 Jul 2026 15:14:01 +0000 Received: from fhigh-b1-smtp.messagingengine.com ([202.12.124.152]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wfJ6z-00000001Neb-3kCl for pgsql-hackers@postgresql.org; Thu, 02 Jul 2026 15:14:00 +0000 Received: from phl-compute-09.internal (phl-compute-09.internal [10.202.2.49]) by mailfhigh.stl.internal (Postfix) with ESMTP id 769E37A0086; Thu, 2 Jul 2026 11:13:54 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Thu, 02 Jul 2026 11:13:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm1; t=1783005234; x=1783091634; bh=elmG8JIJpeTk66rXYrHaUXvfppGofQ+T 9c0tzwc3rVk=; b=K2DLgPeq1oZIFqFTUex/Hpa1C4//fHq0CKLUVLCs7o+7kq8N lHhlUeTnLhk/T3RA55pkYf1R/SI5Hq8hc6kYx8ksiMZgPjKX+skcdxB0sLZBO9Oc F6Gdxdg71MIax1LMC9Yx5TIfmhDO7/KS7OTsp3urk9cXBJjuODivo5UHNnjQ8BBf LbL+QpRUVn/KoMUfmSUmRoyxdytAKaByy6uKA/p6nIbF1LD+zI4XlUYHc/bC60v6 9aDGEt/x9JwyE8J+z1/nUihmzzPbdZ7UXonnYYrCedy//KU0JE0O1QU8U4XjXYWK wrvaKY/mnTdSMJpiK1G0bAp2YZnqTuVxzSpTGw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1783005234; x= 1783091634; bh=elmG8JIJpeTk66rXYrHaUXvfppGofQ+T9c0tzwc3rVk=; b=V w3izYm5dlG7VdTnPJzDtIMKuvyG9sV+/GL9wjt55VslFszarkLZpBBlggd8sFtyd 6XfdpcDq3j4yBC2qC8skilPuEgmx2ESKWUOe1rZRbnzAyAPvZVu7POzhwMdBI3g+ YkHFzQtL8w+7gStlVVIt5tByTd4sLeP+1OJnjQkp+ANtMkVGNQF0DIU0wiBNfR4t TVf2GoKjR/wEbDperujEaW4tTwAZv5PRwFFzYErqI/j1b5DRuSpAbyWf38hwRmXq ew/gSGhTJ7IvxxMZwto1XKeStmaYplyk3JzlIHv4WPH2tYBYXeK9ZN3MTBH6glaZ F9d1lCCpmAIuvb8WMZJcg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTERClSHu6P+4dzyicJQ1NCEVar5mWO8tRTfwYni6m2x12bT0wIto09IE7+Phg+/Pc GS7AC4ae4wH2fCX8G2Xf16i2jyK3LTjV0BTQZc6lEG2+cN0K3UHFpUQByV3SLKJ4ytfVvA fkfBC1tUV4H93JPOm2dY/ZhV6BwiEtN0T3+7gysDmjJQ5zWLgyWX5qsf8lu2pVyvo3pIWP FlaAlBycESi9g/Q3FBTw1Cri9Tmr/syfWaNZRizSQLawsvg82R2KvkogVQ3yeywraN8WTt ok9LFTBHDI9aFnvRDma2njdTS8xXtxBu36CXdZs+WoxUfAflJdL/+Ri1XsRMQbFa/Le5CC RdjoHcJP+ijj1kwif4SfTSbQFv46KfjQoxhtd2FGn0X2VlinHvjB14Gli5zTgZ+Sd7+7Xt rWlj3kuLi8VP1fBzeehjZFbK389nrGnLew2GpeY17/DShRMV/X1wObYKfSlIo2cqaqesBo U3GwxtccKh+19ooOE0/KIe3cSR+rmeL4dM5/FNNNU4ojfWf5xzj+Mj1BsAoS0lehsUgN/R ddmIMW2BOofaPMrHiQnDyjzIlHw4lMB/0hFxSntwQ2QOKoJfQHz+UUPzdYsXe4+CIRzbRO x+wZgwo5KjOyUi58u/gNgyyTTK23ReMpK566jJeFrZuyZdHrtOSQfoLs+pPA X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 2 Jul 2026 11:13:52 -0400 (EDT) Message-ID: <1be5fcb4-683d-4ad0-b327-a34092e09504@eisentraut.org> Date: Thu, 2 Jul 2026 17:13:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: implement CAST(expr AS type FORMAT 'template') To: Robert Haas , Corey Huinker Cc: jian he , Zsolt Parragi , Vik Fearing , "David G. Johnston" , PostgreSQL-development References: <82b4223e-84d4-432d-8167-dd698ce489f5@postgresfriends.org> Content-Language: en-US From: Peter Eisentraut In-Reply-To: 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 On 18.06.26 16:51, Robert Haas wrote: > The reason I somewhat hesitate to endorse that specific proposal is > that I'm not convinced that we should actually treat this as a form of > casting. Casts can be set to IMPLICIT or ASSIGNMENT or EXPLICIT, and > they can be WITHOUT FUNCTION or WITH INOUT, and none of that can be > relevant here. A CAST with FORMAT always needs to be implemented by a > function, is always explicit from a syntax point of view, and the code > to implement probably looks pretty different from the code needed for > a non-FORMAT cast. I am somewhat inclined to think we want something > that's like a cast function but actually a wholly separate mechanism, > e.g. a new pg_formatter catalog. I note that Jian He proposed putting > something in pg_type but I don't see how that can work, since there > are two types involved. > > I don't accept the argument that we should start with this and extend > it later. The patch as proposed is just syntactic sugar. Said another > way, there is existing syntax that already delivers the functionality. > So I don't see why we would rush out support for a bit of new syntax; > anyone who wants to use this functionality can already do so. Getting > the infrastructure right is, IMHO, the interesting part of the > project, and I think that work needs to be done first. I don't really understand the purpose of this feature to begin with. You can already call the formatting functions directly. Does this cast syntax offer anything on top of that?