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 1q07If-0004By-QC for pgsql-hackers@arkaria.postgresql.org; Fri, 19 May 2023 21:06:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q07Ie-00019r-FI for pgsql-hackers@arkaria.postgresql.org; Fri, 19 May 2023 21:06:08 +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 1q07Ie-00019i-4i for pgsql-hackers@lists.postgresql.org; Fri, 19 May 2023 21:06:08 +0000 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1q07IX-000nJu-S2 for pgsql-hackers@lists.postgresql.org; Fri, 19 May 2023 21:06:07 +0000 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-50be17a1eceso6509286a12.2 for ; Fri, 19 May 2023 14:06:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20221208.gappssmtp.com; s=20221208; t=1684530361; x=1687122361; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=ew9XbBG1brfVU/kAkULYWRA2QJ6Ix+nkD8xyAGOnW9U=; b=De37ud2cthWTM9nxlcoG6i/W+QLx51lIjlvs97B4dTTZnbojukFaYll/blEqA6bEMo jJtV8RH6C0Pqn0buyuGcAH1BMQJy/39VGQPUi5I1pKrcqTnoMcMsQL/4gA55y2+S+6vl Zrx5HRlaNER58AsNdpCPQYMWZRNV+U5FgQQoYyW5e9KThwp2vdqA5+2sr25CqewyuzpA jLX8BMSVk3+HcTqigHszzC7oWekqZujl5upkvOnsVw4hiUnAPj8xE5+KL4qZtRqKQX+S T0jjhIB7yAQ4CoGll23NuDZfUQnz54d9dKCVjULURx8kuIIXwFJ3gFFxXTDlPUp24LU8 bpCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684530361; x=1687122361; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ew9XbBG1brfVU/kAkULYWRA2QJ6Ix+nkD8xyAGOnW9U=; b=kYeQIShFr3JIsE4Chh9HewDGdc429wNqUDj30FL0bTso1+es80JQgSeqYKk0nTqPzL x8zDjXdBgkPnSsXFPr1PzGiOCeZAdHNTOQCaZgk4ma+SD0bcpL/GgzwT+s5eu1EaHfFa mOxyfe0urHxA3AZxth8l1sdIm8jzB8U+g2Dzck6YERaJ0YyzLuvyZAQfuND+56mLTQsS 9bkB92YDBONC5sfLyiM6RbvjFdAxBAfQUNDuXupzliN9FX2fSCzKlgP/PtHf7RDTL1pv 74OPqa68K6MhUdm2Og1psxxMYVuataiOMkF6NBYtDSmPokYfYt01mbcHIng+CvL1hjIB 7zoA== X-Gm-Message-State: AC+VfDziBqKUcp0EAErZUmiZ1404XYRniSsOXIdOvLA52KO1HY5m4MII Au/9BJtgAAzTUlWOo2BmVXXnQA== X-Google-Smtp-Source: ACHHUZ5xHWri4yLPlUIkeHMcdpgoda8uGO9pE7BoOV86sLL+HaTYO+gVvqaowOEJgIuCMwqQJTAQ0A== X-Received: by 2002:aa7:ca48:0:b0:50d:bd25:3704 with SMTP id j8-20020aa7ca48000000b0050dbd253704mr3218217edt.14.1684530361360; Fri, 19 May 2023 14:06:01 -0700 (PDT) Received: from localhost.localdomain (62-47-150-178.adsl.highway.telekom.at. [62.47.150.178]) by smtp.gmail.com with ESMTPSA id z13-20020a509e0d000000b0050c524253dasm162437ede.20.2023.05.19.14.06.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 14:06:01 -0700 (PDT) Message-ID: Subject: Re: Adding SHOW CREATE TABLE From: Laurenz Albe To: Andrew Dunstan , pgsql-hackers@lists.postgresql.org Date: Fri, 19 May 2023 23:06:00 +0200 In-Reply-To: <6afd776b-45cf-2675-0cfe-981f1c6ade1d@dunslane.net> References: <1565715.1683923271@sss.pgh.pa.us> <1aac01a1-d9db-8048-9bfa-1e4f9bb69a03@gmail.com> <6afd776b-45cf-2675-0cfe-981f1c6ade1d@dunslane.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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. +1 A function "pg_get_tabledef" would blend nicely into the following list: \df pg_get_*def List of functions Schema =E2=94=82 Name =E2=94=82 Result data = 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) A server function can be conveniently called from any client code. Yours, Laurenz Albe