Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o7FkD-0001bJ-FP for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Jul 2022 12:27:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o7FkB-0000Be-V3 for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Jul 2022 12:27:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o7FkA-00009p-DE for pgsql-hackers@lists.postgresql.org; Fri, 01 Jul 2022 12:27:31 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o7Fk6-0003pr-0M for pgsql-hackers@lists.postgresql.org; Fri, 01 Jul 2022 12:27:29 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 40132320034E; Fri, 1 Jul 2022 08:27:23 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 01 Jul 2022 08:27:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilmari.org; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1656678442; x= 1656764842; bh=mtLdm/Icxjjga6xWcwEqiPGlNqtNm9IbTS23NWgSxgI=; b=2 YdRRCk2jpIx9CKPOlfVRctvL7fuqVmTytqv2w/qxct44gOoYvYHFTC9LkeAnc9wC t3Ex3bR14IAbWsZJTVx9bBk0xaQG9vMo9RLJfWCjdRE6C6VQKd7ixLpNXAHkdayJ +nSd/0/15uNNiZ97fktNcgmO10m2sNGKnB23tLDV6OggBshN9qsBs9QPIAbuEfAm vgd04rSCOgyalCJ0UqvmJzLQ7IQXL2DkyK0KrZxNCEBbxUq3sRqg1AXcoflJTkSb /wAaJp9tzr/ojK9nEA7l16+xbWebJjlbRr38pzooVfwc7lop/5JRyJ+wsZlXD/RF xw61rMrNldUUj93OhGmmg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1656678442; x= 1656764842; bh=mtLdm/Icxjjga6xWcwEqiPGlNqtNm9IbTS23NWgSxgI=; b=q UCD4rYjkrRcuqHUbq7DDYldLG2o95NFT2ozi2TxUB/hfBRq5H+qe56hsN2RfeNH+ m11Gqrz7gGRnalKxaE3k2YnL55gOlNW9h1xRvUw1tx1JLjqF4OkcR25M3BsI7EvR esm162tJcxKHKTu4bzNvwHN7tUKeDbDI6O0OqQPTl4Zl25gg6OVXPgm3zLvmXztm dLajZLRgfkn90VBJk1AqXgFtYJeGV4SEY61UWFL5R6H6qGog2M0b+c6/3/ropaWi o+QT00m7kfgs5yxBz8tM9tc8j5973m6/Fs3qM5iENdbZbXo3eRJ6vlXhtm7aJyPz h/Ig9ryhzh/5INR3ZoKHg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudehfedghedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufhffjgfkfgggtgfgsehtkeertddtreejnecuhfhrohhmpeffrghg fhhinhhnpgfklhhmrghrihgpofgrnhhnshonkhgvrhcuoehilhhmrghrihesihhlmhgrrh hirdhorhhgqeenucggtffrrghtthgvrhhnpeevvdfgfffgteehheekudefveffkeehvdek feduuefhvdehhfehuedutdehueehueenucffohhmrghinhepphhoshhtghhrvghsqhhlrd horhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep ihhlmhgrrhhisehilhhmrghrihdrohhrgh X-ME-Proxy: Feedback-ID: i1ff147bf:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 1 Jul 2022 08:27:22 -0400 (EDT) From: =?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= To: Peter Eisentraut , Tom Lane Cc: pgsql-hackers@lists.postgresql.org Subject: Re: [PATCH] Add result_types column to pg_prepared_statements view References: <871qwpo7te.fsf@wibble.ilmari.org> <58307e2c-a26c-d438-27f7-5bef9f693943@enterprisedb.com> Date: Fri, 01 Jul 2022 13:27:20 +0100 In-Reply-To: <58307e2c-a26c-d438-27f7-5bef9f693943@enterprisedb.com> (Peter Eisentraut's message of "Fri, 1 Jul 2022 12:28:49 +0200") Message-ID: <87v8shj9w7.fsf@wibble.ilmari.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Peter Eisentraut writes: > On 19.05.22 17:34, Dagfinn Ilmari Mannsåker wrote: >> Prompted by a question on IRC, here's a patch to add a result_types >> column to the pg_prepared_statements view, so that one can see the types >> of the columns returned by a prepared statement, not just the parameter >> types. >> I'm not quite sure about the column name, suggestions welcome. > > I think this patch is sensible. > > I see one issue: When you describe a prepared statement via the > protocol, if a result field has a domain as its type, the RowDescription > message sends the underlying base type, not the domain type directly > (see SendRowDescriptionMessage()). But it doesn't do that for the > parameters (see exec_describe_statement_message()). I don't know why > that is; the protocol documentation doesn't mention it. Might be worth > looking into, and checking whether the analogous information contained > in this view should be made consistent. A bit of git archaeology shows that the change was made by Tom (Cc-ed) in 7.4: commit d9b679c13a820eb7b464a1eeb1f177c3fea13ece Author: Tom Lane Date: 2003-05-13 18:39:50 +0000 In RowDescription messages, report columns of domain datatypes as having the type OID and typmod of the underlying base type. Per discussions a few weeks ago with Andreas Pflug and others. Note that this behavioral change affects both old- and new-protocol clients. I can't find that discussion in the archive, but someone did complain about it shortly after: https://www.postgresql.org/message-id/flat/D71A1574-A772-11D7-913D-0030656EE7B2%40icx.net I think in this case returning the domain type is more useful, since it's easy to get from that to the base type, but not vice versa. The arguments about client-side type-specific value handling for RowDescription don't apply here IMO, since this view is more user-facing. - ilmari