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 1wWfO0-002m3L-0j for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jun 2026 19:11:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wWfNy-003ehT-35 for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jun 2026 19:11:46 +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 1wWfNy-003ehL-1j for pgsql-hackers@lists.postgresql.org; Mon, 08 Jun 2026 19:11:46 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wWfNw-00000001jPd-0ag7 for pgsql-hackers@postgresql.org; Mon, 08 Jun 2026 19:11:45 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-5aa68d7d757so5036943e87.0 for ; Mon, 08 Jun 2026 12:11:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1780945902; cv=none; d=google.com; s=arc-20240605; b=FmKvwnFpJ2dn04NLukI9ZnnXiuT+j2UmRyQtaRmyWkUkedTpEbbm+bKAtuQv6EwD+a UMuZd52VdJ3p9QAoWSYnw/xopo3fABtyLd2uCa/djkcXef7wWlmEgVzshoA2zc0lLc+N It4DNaxR4FwUWXSygNaVqDH3Rn5OQIrIjcHHXXaPV1yhOxiHdmuvgqWPaidL00yGXebI aX4SEmiO3CTWwcu0LVWwyHkxqert9IULUWnqvQMHQosBOp5qaTWyhrhlG0xf/sDdFPKW RJJ0P/gRs8KpEpTtd6m40lUhr02U/cYESpFLKn30pCCVX8x6rKeRA/9wucO7//6U7db+ bjRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=qyyj0qUqcy8iAfNQBhAbp6ADLEp7/v+ora7fVIIG82c=; fh=TcrD3aWP3vuVeHal17CwT9EJbhRgyZhRu6qQdMhKAiw=; b=Si1MysJ/x7yYgZYSocsNh+Ufiffk1RC5/cvT07na/668HiFDwDgIEC4oqvm6Zo8LxB mwCryZbW1L8OWpcJL3DI1DuaVYnkaKAeODyKeXqMSI5mw4fSK46sa/MeWb9YnReURwxZ NIrt/z1ByRlwPcmNr/xEDZYFhAkbTP6kA39PMkcHUY22zDJPGtmK3rYXKyiTHKV6yk5o B34S2s4XAM/nIpYB73mWXlTxKmY5gsXUeWMwXFnLDqh2zBY1+sVMvATHE0zZZJGaoAJt oq22oO4ze3Lag++GLJb0NiuB18eCvcKl+pdwdOhFYpGEiHOgsxSsCSz0yvd3jc6TIBYW L1UA==; darn=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=1780945902; x=1781550702; darn=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=qyyj0qUqcy8iAfNQBhAbp6ADLEp7/v+ora7fVIIG82c=; b=IwNx2HUscPuCoJ377b9/G2ADUE/6ACHFNE5kn8BK3UVNT2QlyISHBW+qVFcLp8C0kR g5CvkkjbcTe00US7CUDHZQGJOD987fmYgosWvXngO1TOe51rmuejYBL67kSS72w6CrFm /QJgzZUmwxnAkPwF1pEPKiCdQYHVI6ZuGD4HDxEUVWtqO1FTslIuk6WBQ4YQPUu9MjqK RuPfUo8U6CcCTe4/3OWgYMvSPm2J6S69GcBdt/uArYC2ofvt7/tupSuJO2svIU6eEEqA VBlDtvRnJJT3gBrGJEIvSdHEikaBmxeEoLImMe2yTlBQLLeK22s/p4RDiSgWOka8pd9c apSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780945902; x=1781550702; 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=qyyj0qUqcy8iAfNQBhAbp6ADLEp7/v+ora7fVIIG82c=; b=tX6SU6YChuY28BIFlxaxMWxH5P944yHNo+xPFVhmymE9OJ6vZXNPhXeD807aOqdOBL KRAyhliLePzHt9Z40eBeYPB5hx2LGDtPNWSrEof3GvpR2E855LyArGep9fvWbqq3IdBE XJsydpfbZqxkBBdwBCxg2bwbUGZXDGJKxKfdnl4avQ7ajXssZpmUevpKLqsKeAFnGX4n FSyB0fcWGSm9w5xrpGlMcOdzd96JjT+3Opi/lYU2RJfrLFF7DBqCZsZDKv75McYCTRzq RcfjslbCiXU5qDsWnsYZzL2b2KeL6/E3Krbs/diCTseHR59mrbPJRucXRjdZWjsNxjNf +jvg== X-Gm-Message-State: AOJu0YxBOWrGwScOk3qp0wordXaLVlkv9nCrC71MeDeGNWKhQLxwi85G NC0jLoAoP7owaX/5BTczkqd/4SaioQT1PefTNPA9p35J7mHcMeUfq/ZY7I75zAVZ0TJj7Hnujp4 SjTitgUJH1/BqkZKMyVRytBt0JELVL8g9RLLqD63p X-Gm-Gg: Acq92OHeK9ppNUoJF34oDgGO2kIxN9TGyMMUdCA/JUoPBApNfKFxq8hRAq0OsGOXquY HqS/WI5q+blDO+4P7hC5w//p8YCFO3BMpFnubpP2Zo+DQrrJrIBu3xDRhc8s8dELbuvpaE4vYRJ MHvwv7P/Pr0UAec+YvI+8noMP8mcAkNX5hLeYkeZBR/nfrX++oAesIEsRcqy+iRXXdRJ7yh0xPH F4J0Kx1LdNocsC4Og7yInDWosvnlQY86rkBkJ9HzHgG/owADB68g86/QdU9IkLoHHD4qZ8u2FHP U6ZL8RI0rViSD/uD X-Received: by 2002:ac2:4423:0:b0:5aa:7397:6cda with SMTP id 2adb3069b0e04-5aa87bdde4emr3300627e87.27.1780945902219; Mon, 08 Jun 2026 12:11:42 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Marcos Pegoraro Date: Mon, 8 Jun 2026 16:11:05 -0300 X-Gm-Features: AVVi8CcjBrF8EIqC8fCXEFLt9azEmjHknMpY97SbvvayQM0xsgpCYyEcqVb2jc0 Message-ID: Subject: Re: [PATCH] Add pg_get_table_ddl() to reconstruct CREATE TABLE statements To: Akshay Joshi Cc: pgsql-hackers Content-Type: multipart/alternative; boundary="000000000000ddc3810653c2c747" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000ddc3810653c2c747 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Em seg., 8 de jun. de 2026 =C3=A0s 08:30, Akshay Joshi < akshay.joshi@enterprisedb.com> escreveu: > Hi Hackers, > > Attached is the v2 patch, which fixes the Meson build failure, and the > rebased patch. > Would be good to have an option "schema-qualified" boolean, because sometimes I don't want a schema-qualified result. Suppose you are duplicating a schema, the way your did you cannot do something like this to have a complete script to generate a new schema select 'create schema new_schema;' union all select 'set search_path to new_schema, public;' union all select string_agg(pg_get_table_ddl(oid),',') from pg_class where relnamespace::regnamespace::text =3D 'old_schema' and relkind =3D 'r'; regards Marcos --000000000000ddc3810653c2c747 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Em seg., 8 de jun. de 2= 026 =C3=A0s 08:30, Akshay Joshi <akshay.joshi@enterprisedb.com> escreveu:
Hi Hackers,

Attached is th= e v2 patch, which fixes the Meson build failure, and the rebased patch.

Would be good to have an op= tion "schema-qualified" boolean, because sometimes I don't wa= nt a schema-qualified result.
Suppose you are duplic= ating a schema, the way your did you cannot do something like this to have = a complete script to generate a new schema

select 'create schema new_schema;' union all
select 'set search_path to new_schema, public;'= union all
select string_agg(pg_get_table_ddl(oid),&= #39;,') from pg_class where relnamespace::regnamespace::text =3D 'o= ld_schema' and relkind =3D 'r';

regards
Marcos
--000000000000ddc3810653c2c747--