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 1wewb7-0059TF-2b for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Jul 2026 15:11:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wewb6-00EQ2T-0c for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Jul 2026 15:11:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wewb5-00EQ2L-2E for pgsql-hackers@lists.postgresql.org; Wed, 01 Jul 2026 15:11:31 +0000 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wewb3-0000000167e-1v04 for pgsql-hackers@lists.postgresql.org; Wed, 01 Jul 2026 15:11:30 +0000 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-39b3027009fso6801291fa.0 for ; Wed, 01 Jul 2026 08:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1782918687; cv=none; d=google.com; s=arc-20260327; b=GxrPWhlCbMr6hxe6G34k9XCt7rq/E0E+SzMqGNh0pAJ8zV29Viz0PZdT/jkFO0sHah rKbMWtCjC6+pWsvdfrvFGZtF0gUu2c8nl2hkFt9csHucyDAMUkMYBt1QOAfpVt9e2emT 7muRyuc2fvniMuhStJDi2wX314ixWogRP++8Kj1fW0ywjetkmY7+klhVgQlTlp59VyWb yCFrUShyyXt5oiueJaKPbL7fxNnafeantWGtgwV8l13j6KHr07B2zbbN5mBrJ+gRWH5W Tiene+KM/k4o/EbAISwp1IaReslILYJlZFszJ51OcDBBRH/TZ3kC4OPy3ExAyQyWsvjL TLEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=Epq5nkOraeejOPUzkTh5bTn6c2SjZLSftP7HDGDjpgM=; fh=qi4cu3Vx3TwQRPNtc322PwB5rnDtAV3+qp8pi677QKw=; b=SwG6Pq8bDuH0fIvdVl8upDnTpbFLx84DyKyIxvcvfTOfuLT7wXhjTPofauIG0hntzc K9J+U45oWLQpFCAcsKIGaPvexO1asL5+7wXocrY3ClLFPWXvMY6bfQ9F9PHrkJXRoiyX m75lhDV9A4itwsYSMLHUahzql9LlImWtrLzwCUoMNEbH7qKrnXlLbDypBbKfiW256+EH OHNQs0L+bEVOFDKo/R7V/zJSlRiiVrvzXKel7r9sFbu/iT8DNLmreKD5Ol97w4sWuXzP b0daQsyh3+jV0BcEFiH/o2e2xl1w2/bcRbe7DTFU3PfHSSXdyy1DS394JVXEzWyk7Dnq hJ3A==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=f10-com-br.20251104.gappssmtp.com; s=20251104; t=1782918687; x=1783523487; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Epq5nkOraeejOPUzkTh5bTn6c2SjZLSftP7HDGDjpgM=; b=zZ2uPAiwmWOMdizOXkffi0ux+F4PXFMZjF7oOuXaTF+c0MGdq/pvL50a8BLj/Jgdig YLw91ygvOTh5PTLXQpdyuoZZPmCxCeKQg/ev8AFWFtPowgiXS41NPmJ6Z4bxmVEESovw v8hPbewJHrCxfGbpAiJ5s/hQ097dx37PXzmchD150ghh3NdLC2c02VMwqr6cKtwK5UIu GWUHybLKg/F8UkUwUOLtxH41BIOz16JpbKbZoAxDr8vnvioyoKVUjRz7xusH4eAzOUHm km6+eX+PIonJz0PRMnqKaV7yl1Pp6fBiehm6iiWJMpiiAu65v3TINHKD++74HBn/lWpD dB2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782918687; x=1783523487; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Epq5nkOraeejOPUzkTh5bTn6c2SjZLSftP7HDGDjpgM=; b=gcRGAVdjx2sGEYwSBMosGNSDDVzP5cXYrG/Fg2acJAsa3/3gj3L/8FOL7V47Q80UYo wTaHIrivJHBpSAh8jRHTxLWTXj+0m3uS1idp3Ikrbow6/+SfySycVM0fQMtruS1UU+qd FCADBoKN66gpKojM2amq8YfxPamVjYfBS42aMjbFWrHRspaY0tNTb1lhCkI0JX7c5Ieq jra8z/7hNOgbu85BoucpNnajPFH8msSRPjnLg89MeXwvekCaDTSYNwwOWp+Y8gHP8tmn jo4bYoRElbmwaYZBlc6hLgujutEEbor74u+4gapcO1mvbKIM0OR9KWhVTbEl61MhLGSS zmuQ== X-Forwarded-Encrypted: i=1; AHgh+RpNAxDcdj7RMWngOQwyX8NR/j/FxQneyH1TJEQEvJUy/ATPVdQyGwnXHQ0WG3YuAefPNJ7canpeIpsiAj8o@lists.postgresql.org X-Gm-Message-State: AOJu0YyYiePxjlnrBV3GWRBsJfhQJUfQ1g4sUPbS1CQmdHNnYQ/NBU5R FmY5RqdgGoJKoVkin5QX3CwYkOk37AUPMq0Ufk7xK1RG6xTaSPh3v4Q8UVKKEMJwqZzrfmjlhay ahJxzHGLBMkODGwooPG1DC/rVJfD+tPx/3gxnRrIeXWeDW2kRD6iRFA== X-Gm-Gg: AfdE7cmk8FL4ER9x8Kh8vnlzkjHjPl1KG9iUjFRxcnt6iMa+R8sm8nnBZlgWYbjJhiy 1PT/4uyhYvumgRBMFfzASgaQdbXPrruT2Fps/4LS+6UcEHM942wSktzemBaBc46iDet5d+5gaVZ AzDttJ81EpYgOS4E5448iWE6vdG1MD4p58YkInTszUCkbrEOCsODhrvasA7SIt4D6yDJ9wSCVbp jLf5QtGKNVkbp3J13Tf7OcUDFHRYHAZqNgXETLOHBCPD51daOtkn+7aDNO/furH924Y+CoMYQ== X-Received: by 2002:a05:6512:2c9b:b0:5ae:adbb:43c2 with SMTP id 2adb3069b0e04-5aec68b77bamr444367e87.33.1782918687053; Wed, 01 Jul 2026 08:11:27 -0700 (PDT) MIME-Version: 1.0 References: <983C7B03-D9C3-4F15-8913-7616EC5E6414@gmail.com> <20260623.162104.775158751399277188.horikyota.ntt@gmail.com> In-Reply-To: From: Marcos Pegoraro Date: Wed, 1 Jul 2026 12:10:49 -0300 X-Gm-Features: AVVi8CeXqqo389i-tHWGjctLqHQaTCizsz6QkqR9NFQK6dlIKam6GOvYdYFjLUE Message-ID: Subject: Re: [PATCH] Add pg_get_table_ddl() to reconstruct CREATE TABLE statements To: Akshay Joshi Cc: Zsolt Parragi , pgsql-hackers@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000016dcb06558e1b30" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000016dcb06558e1b30 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Em qua., 1 de jul. de 2026 =C3=A0s 11:12, Akshay Joshi < akshay.joshi@enterprisedb.com> escreveu: > pretty, owner, tablespace, and schema_qualified are plain boolean > parameters with DEFAULT values > *Filtering parameters:* *only_kinds* / *except_kinds* as text[] > >> If all parameters are optional, and all parameters are boolean, perhaps you could also make pretty, owner, tablespace, and schema_qualified as optional parts of only_kinds and except_kinds. Therefore, we could call these two ways and the result would be the same. pg_get_table_ddl('idxd'::regclass, owner =3D> false, tablespace =3D> false, except_kinds =3D> '{primary_key}'); pg_get_table_ddl('idxd'::regclass, except_kinds =3D> '{primary_key,tablespa= ce, owner}'); Obviously this way you have to know if owner param is false or it exists on except_kinds. What do you think ? regards Marcos --000000000000016dcb06558e1b30 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Em qua., 1 de jul. d= e 2026 =C3=A0s 11:12, Akshay Joshi <akshay.joshi@enterprisedb.com> escrev= eu:
pretty, owner, tablespace, and=C2=A0schema_qualified are plain boolean param= eters with DEFAULT values
Filtering parameters: only_kinds / except_kinds = as text[]=C2=A0<= div>
If all parameters are optional, and all parameters are boolean, perhap= s you could also make pretty, owner, tablespace, and schema_qualified as op= tional parts of only_kinds and except_kinds.

Therefore, we could call t= hese two ways and the result would be the same.
pg_g= et_table_ddl('idxd'::regclass, owner= =3D> false, tablespace =3D> false,=C2=A0except_kinds =3D> '{primary_key}');
pg_get_table_ddl('idxd&= #39;::regclass, except_= kinds =3D> '{primary_key,tablespace,owner}');

Obviously this way you have to know if owner=C2=A0param is = false or it exists on=C2=A0except_kinds.=C2=A0
What do you think ?

regards
Marcos
--000000000000016dcb06558e1b30--