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 1q0QLp-0001nM-9W for pgsql-hackers@arkaria.postgresql.org; Sat, 20 May 2023 17:26:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q0QLo-0003ot-4s for pgsql-hackers@arkaria.postgresql.org; Sat, 20 May 2023 17:26:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q0QLn-0003ok-Gi for pgsql-hackers@lists.postgresql.org; Sat, 20 May 2023 17:26:39 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q0QLj-0011Dq-GL for pgsql-hackers@lists.postgresql.org; Sat, 20 May 2023 17:26:38 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id F346B5F7B7; Sat, 20 May 2023 13:26:29 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=snowman.net; s=dkim; t=1684603589; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GddA1UlYmVzzRJotsWiuVURAjir40BskFM5qnI0G24Q=; b=jsK5DnuXjMVuIs+BiNk7yMSC4zLVd8ayJiXSnCQK04xQeXr7x6dz7BYnRMMQrpU+HTVucT Wd6Rax2thtvlfc4Md6pph1FhfeR4NlTBXNJ5lDl1juUTc1or+EEWP+FhNk1HdxMzUvwfCi /iOs7ArGOtVoKzaTeViTp9EhcCGC59k= Date: Sat, 20 May 2023 13:26:29 -0400 From: Stephen Frost To: Laurenz Albe Cc: Andrew Dunstan , pgsql-hackers@lists.postgresql.org Subject: Re: Adding SHOW CREATE TABLE Message-ID: References: <1aac01a1-d9db-8048-9bfa-1e4f9bb69a03@gmail.com> <6afd776b-45cf-2675-0cfe-981f1c6ade1d@dunslane.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="07fDLHYPlnf1pUaS" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.1.4 (2021-12-11) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --07fDLHYPlnf1pUaS Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Laurenz Albe (laurenz.albe@cybertec.at) wrote: > On Fri, 2023-05-19 at 13:08 -0400, Andrew Dunstan wrote: > > On 2023-05-18 Th 19:53, Stephen Frost wrote: > > > * Kirk Wolak (wolakk@gmail.com) wrote: > > > > My approach for now is to develop this as the \st command. > > > > After reviewing the code/output from the 3 sources (psql, fdw, and > > > > pg_dump). > > > > > > Having this only available via psql seems like the least desirable > > > option as then it wouldn't be available to any other callers.. > > >=20 > > > Having it in libpq, on the other hand, would make it available to psql > > > as well as any other utility, library, or language / driver which uses > > > libpq, including pg_dump.. > >=20 > > I think the ONLY place we should have this is in server side functions. >=20 > +1 =2E.. but it already exists in pg_dump, so I'm unclear why folks seem to be pushing to have a duplicate of it in core? We certainly can't remove it from pg_dump even if we add it to core because pg_dump has to understand the changes between major versions. > A function "pg_get_tabledef" would blend nicely into the following list: >=20 > \df pg_get_*def > List of functions > Schema =E2=94=82 Name =E2=94=82 Result dat= a type =E2=94=82 Argument data types =E2=94=82 Type=20 > =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=AA=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=AA=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=AA=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=AA=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90 > pg_catalog =E2=94=82 pg_get_constraintdef =E2=94=82 text = =E2=94=82 oid =E2=94=82 func > pg_catalog =E2=94=82 pg_get_constraintdef =E2=94=82 text = =E2=94=82 oid, boolean =E2=94=82 func > pg_catalog =E2=94=82 pg_get_functiondef =E2=94=82 text = =E2=94=82 oid =E2=94=82 func > pg_catalog =E2=94=82 pg_get_indexdef =E2=94=82 text = =E2=94=82 oid =E2=94=82 func > pg_catalog =E2=94=82 pg_get_indexdef =E2=94=82 text = =E2=94=82 oid, integer, boolean =E2=94=82 func > pg_catalog =E2=94=82 pg_get_partition_constraintdef =E2=94=82 text = =E2=94=82 oid =E2=94=82 func > pg_catalog =E2=94=82 pg_get_partkeydef =E2=94=82 text = =E2=94=82 oid =E2=94=82 func > pg_catalog =E2=94=82 pg_get_ruledef =E2=94=82 text = =E2=94=82 oid =E2=94=82 func > pg_catalog =E2=94=82 pg_get_ruledef =E2=94=82 text = =E2=94=82 oid, boolean =E2=94=82 func > pg_catalog =E2=94=82 pg_get_statisticsobjdef =E2=94=82 text = =E2=94=82 oid =E2=94=82 func > pg_catalog =E2=94=82 pg_get_triggerdef =E2=94=82 text = =E2=94=82 oid =E2=94=82 func > pg_catalog =E2=94=82 pg_get_triggerdef =E2=94=82 text = =E2=94=82 oid, boolean =E2=94=82 func > pg_catalog =E2=94=82 pg_get_viewdef =E2=94=82 text = =E2=94=82 oid =E2=94=82 func > pg_catalog =E2=94=82 pg_get_viewdef =E2=94=82 text = =E2=94=82 oid, boolean =E2=94=82 func > pg_catalog =E2=94=82 pg_get_viewdef =E2=94=82 text = =E2=94=82 oid, integer =E2=94=82 func > pg_catalog =E2=94=82 pg_get_viewdef =E2=94=82 text = =E2=94=82 text =E2=94=82 func > pg_catalog =E2=94=82 pg_get_viewdef =E2=94=82 text = =E2=94=82 text, boolean =E2=94=82 func > (17 rows) >=20 >=20 > A server function can be conveniently called from any client code. Clearly any client using libpq can conveniently call code which is in libpq. Thanks, Stephen --07fDLHYPlnf1pUaS Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEwf6gbxKhD863zrx/7WyKOINHZFUFAmRpAsMACgkQ7WyKOINH ZFWW6w/+OYazHn7pk1zbmAp2K7u8LyUafaGSaQdby3hNCq/exkA2Z363AZUdIm+U dkSjp1Fr3FM17hIIUHMBNPjbMGq/3XzUG8uueCFNrZI97+7zFK4/Eso06NNnAzAQ ovjbdQOIKJyOzFyRTUl5vFDuvYrXXUEc986YbEiWKDpGby3WbS+SAOdN400to2PE crGHL6dCuSmhJ+ho2fr4np2UGvIuQ0X49TzP1q8NcBN/YOCWYUDaLoK2Bt6erOUp Sa0JngcjTNv7UoWTbybAFURF7frRootmUXUEONzecryWctHEP5Xc7+p4qQEepdMm iUUvnsTCWdHXIGNjhJfpyKA79Yzrbu+y99dsLOyFxervtHMBytmeyvY1VJSmS7nx h3SYSe8QxsMwK9cMryC7KBR2Syip8QNohtNUuqU3qnzR+HNfkv5IjWZGLBaQhETR sdhGThGST6ga/2fVp3I54F0NblPq6sFJVCOZprhI4/GXvHYx4dHYuBY4whIeFuBN XlXpaUrzDGHyzSFV4DQlB1V7vLr6AYiMzw92+CllwhsRO1b5t81KWFIFCM+7nIA3 WG4gBPfy4eXgKoZUBbcXxyS7YGethwjKvLmQ2YUJw5XKXab4ZlPdJtSUXgK4qM1M HUGdQ8+csxYcUB3IG5CFWXTUBFmN3VM6ioHv9dfiVa8sVIgvJs4= =E1vZ -----END PGP SIGNATURE----- --07fDLHYPlnf1pUaS--