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 1wHzx4-007h26-2e for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Apr 2026 08:07:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wHzx2-002S31-2q for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Apr 2026 08:07:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wHzx2-002S2t-1f for pgsql-hackers@lists.postgresql.org; Wed, 29 Apr 2026 08:07:20 +0000 Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wHzx0-00000003lPK-1PiZ for pgsql-hackers@lists.postgresql.org; Wed, 29 Apr 2026 08:07:20 +0000 Received: by mail-qt1-x830.google.com with SMTP id d75a77b69052e-50d864c23bdso384081cf.1 for ; Wed, 29 Apr 2026 01:07:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1777450036; cv=none; d=google.com; s=arc-20240605; b=Gtdmkbcjj/1TPLF1Bi3PdHzw3JW6y8UDTs3hdWoVsqNDvam216wO5tWvBXnSM637Mi uemrvxOyPjuErkKl9LRWJT5NAkonrWw+cvyVY7BqlQsgwWY3FAzUM9glz6u68OZSkzYd 2ng5AxSSlKZBkTYRuSSF0KfGvPAXyo6MQ3+0jKzt6GYRBfR7cqnqnWK3bpccwjN2OMDE 60+9TNqojcxExbBL1pAhzIznmOuI24qMeXqK3VZXsyjpvnwDAGltCpDF+S1dXI2kUXIP HUPexWyoZFOYhCqOJ1g+gcVvtjDsv2Di1hTpLYw0+LJCMBkU15PTCAVCUC5Ozm8yto7E t6WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=t8JCgfK3T7QP0u5v8qhB2mLJO6/bkPGiYP2KcTthUZc=; fh=ET8VM1vn7WPOSjBTwCPea2aGUBNu9TlWel7g5QN2Wm4=; b=N9tDvlMhZwwYJtUyKWRjSRhfeTuABv+Lb8B8X5kCtXxSV/FLV91GFFAA9fRLfIPNr1 d+sbpI+a4wo6RoVJ/d89ydI7ajEKdomTORSfCUAP57+ryhg8i1iwSBW6DNaAoXfT4UNm 92SVRhfsi48QAtwUv2W58wRdlDroJ2ahX64ts99Jc69Js71KPdo1Pd/cX7hjNbPZBExR d7EZF8eYDyQB2IDEpRzYV44c/tGjopqSwzmXehhKS3NtpRkeFczGpMxeBq98EbvNR35s X7zIc6/xEDXyx2LH5pLc+Se3fuDfLc4G85gaMFAr4CSLV7Ht4i5v/HL36zEDTKBhkanh v6dQ==; 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=google.com; s=20251104; t=1777450036; x=1778054836; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=t8JCgfK3T7QP0u5v8qhB2mLJO6/bkPGiYP2KcTthUZc=; b=hnLnqFAN2bJbl+qTz9qM2dID7SMKvs+G7lNLnWtZBl/ty3fNG+/7S6qUz/JPR4O3z3 tYaic43ODoK8UjdmLJEDtnukpFSEEOGlHVIUgmc2jIKShDF2gJTKmkuNPdBxZBUowown UVYuG92R3TvpEpp6bgyrtxnSxjukYVIsvqxMIkoGR3stgBKzXJ+TkEluVfcnGXS+nmBy 8TvC9l5AtmhKttJKAG1mb2MFVqb0nnt30kH11bgEx4Gun3ldzmYp7pH7/htQbJp4Tawq ctmvO02ai7tOMe+/Tqf2gj24ajoYCZto+pvlOzJmcQKKphbpMhX0JjIrckOJjIqILL31 wtWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777450036; x=1778054836; h=content-transfer-encoding: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=t8JCgfK3T7QP0u5v8qhB2mLJO6/bkPGiYP2KcTthUZc=; b=WcBebW2DtjiA9tNEdY/TY3OcNS8lAT4acXoAYa8Q5Ma8+Wt0Lt5BJOrXPWR9FIFLL3 95S3+fwtTtZKnZpIjk6drvRV8f+pkFm2ufS5QAGrCsKSoOfI5usEvtnchXdfT//tpj8A xWnW3PJeDUV4iw4W0HnLXaIGSMOShpxpMaSiy9FxAqdIwNXMPpNBC2ec+Ze535Qkw/Xl NqZzDT293flw7eQoogj3Yp3eA1K7mt/hKevVv3z87rB/LM08VvB52F5XKWlVPj6JjqVD zzZxbleJZZeoyqZdNn0YDrrzNFEKWTs5EOcyTjVeeSVCmk/yVIKaV4xpwBfKde9FvVpd HEfw== X-Forwarded-Encrypted: i=1; AFNElJ9eg0NUJTO2GS12AhIrmjGVmytZ4N6s8yO36pMl3/QwIWH/e0tuZPh3pRiDPyUuhb2CNLG3win6f3+YXzXw@lists.postgresql.org X-Gm-Message-State: AOJu0YwOdh7y9nai0yfL/8E2DaaGYMc5RWzd/akTkQZ1jOLmf7cu000X Oe8moiy6KXsizMu2E6uSePbo4ZkYXcblI3HcjQwzrvwkdcN6zzYmSDsHI792hQnCGVkjWyVyZGr jG+IIxW1Ar4jeWtJjGa4EvYZJFSXKTX7uVlsAEfRj X-Gm-Gg: AeBDiet9cOSIrgamMGkNUHfQZA32F0k+7NVTqjZkXYiU+/KJk/wFftmV7u76sqBp3d3 sNKmicx/prq/JtnY0cUjd4AESwhYh9+dChA0s+GGjMLNLhvyCbmwFRg+Cu1qBEMHvaKLNt+K/el oPTu0/4Y7gC78kgIzXSE/enSxx+rlYA1CT+WmaFeM0tjxLLQ9aH+eKkm4+tm1EWoA7HGXG6UKNL denhFHWSh+VXrL4prPai66DwxHtiy4rC+aRtBiVMYiC0ToR1rt5BvVaPBdzv1hQleTTMef5ybZh qcKh+qo94BgpvLAxdhit52bI/j1+/SXGTNMPOfKZizxj2yzOTZR8AKy9A/IJVg== X-Received: by 2002:a05:622a:a98c:10b0:50e:5e19:587a with SMTP id d75a77b69052e-5101a5e4a9fmr7882061cf.3.1777450035340; Wed, 29 Apr 2026 01:07:15 -0700 (PDT) MIME-Version: 1.0 References: <080f9394-c127-4cef-865e-10f2f997125c@postgrespro.ru> <38690b0e-f91b-46fa-b72a-57775612e463@postgrespro.ru> In-Reply-To: From: Hannu Krosing Date: Wed, 29 Apr 2026 10:07:04 +0200 X-Gm-Features: AVHnY4LNOQKky7M7NP6KLjkb47csiYwX0uvKMYAle3FmpxiLMz5iRWjh6ssukug Message-ID: Subject: Re: Support logical replication of DDLs, take2 To: Dilip Kumar Cc: Amit Kapila , Masahiko Sawada , Vitaly Davydov , Ashutosh Bapat , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Apr 29, 2026 at 5:39=E2=80=AFAM Dilip Kumar = wrote: > I am trying to understand your idea. If we are trying to deparse from > an actual system table using a snapshot, why don't we just use the > WAL? I mean, the WAL should contain the actual catalog modifications > it has made. We have the full data in the catalog and we would likely need catalog queries for any change, even when de-parsing the tree. And we should not add the extra load on the original DDL side, just as we don't for DML. At most we could just serialize the statement tree into the WAL, though even that may be an overkill if we can get the change from existing records. - insert new row in pg_class --> extract the CREATE TABLE (or INDEX, or ...= ) - update row in pg_class or insert, update or delete a row in pg_attribute --> extract ALTER TABLE - except when it just updates relfilenod --> extract TRUNCATE - delete row in pg_class --> DROP TABLE - dml on pg_constraint --> ALTER TABLE ... etc > Although converting the catalog changes into a deparse > representation of the DDL could be complex no? Both de-parsing the tree and converting the catalog change could be complex= . The advantage of using the catalog is that we already have decades of experience doing this via pg_dump. > Another question is > what we would do with those deparsed representations: will we convert > them to SQL on the subscriber and execute, or do something else? Current pg_dump approach is logically equivalent to "doing it on the subscriber", pg_dump is designed to dump schemas from all older database versions in format that is compatible with the version the pg_dump is written for. This brings us back to the uncomfortable discussion of needing to back-port some changes to older versions contrary to general PostgreSQL development principles of adding new features to only the latest version. Or we could enable exporting the catalog snapshot from logical replication stream so that subscriber could use that snapshot in a "callback connection: to extract the catalog state at that snapshot