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 1nVGLu-0002ya-U6 for pgsql-hackers@arkaria.postgresql.org; Fri, 18 Mar 2022 17:25:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nVGLt-0000jQ-MV for pgsql-hackers@arkaria.postgresql.org; Fri, 18 Mar 2022 17:25:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nVGLt-0000jH-Bl for pgsql-hackers@lists.postgresql.org; Fri, 18 Mar 2022 17:25:25 +0000 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nVGLq-0005Ga-Rx for pgsql-hackers@lists.postgresql.org; Fri, 18 Mar 2022 17:25:24 +0000 Received: by mail-ed1-x52e.google.com with SMTP id a17so10009637edm.9 for ; Fri, 18 Mar 2022 10:25:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=e1mOuTpluhEvIscEckFw3mwlZRJMT2hTD+vWRzAOGa4=; b=S8o1gWspoHntLf8/7TmbwG5zByfILrFHxJdmkU5O5cz3cuHmI/eUWLReOzB3rg2h/C AO6ouv3txDWZFDl93HPMYydVSOL60JQ4MBYSQxMq1ciagZ499qhoJyJ0CLd5i+tLduSh WPhQ9myXjJGSeWmFlplFFNhwuGmFGdKgmajGn4ZPYKB3/mzOybWH23VJOX80qBaox9AQ J5g2DztfotnlrxaVU2YJq0yzaCSfgwASQYaOMAbDHedjj/p5PidhIZ05QD7vXYuaWbEF yLwkvu8pwrqqM6KYTsbpn9TreJzEL3NPqjKgO9EY8QUdIogdxIXjQzcmNSJkR/iRI+2+ H0Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=e1mOuTpluhEvIscEckFw3mwlZRJMT2hTD+vWRzAOGa4=; b=oeNs8yq3NLwFgKqvC7JO8jAUzLzB4r0Qv1er1k3PQxSMzRPOMXy0/Ar1W7V0rqYprt /V5iXRrgqdaqPK65Gm+KupuaNPxtmOUIIcRfhyZYV+MyEA2HH1M3DSHGHSdZXysWksWU rVxO1iTQ+m8yBXGPF91wfE8SQylwq31+kU7NENiHzQtVa41GHTQimg8OWM4IbOttNJT6 dEXgVDwRDUM97F8Uwh+Ck76lmHP80NGurTBhTyV4ev+AAXTyHrzXtrhxd8Xp/QZQNAQd rslEvyPUJLPVKyt5ipKDFDRkB7+yn3+9N0eUzehg7WqWv/8s0xlVe6AguPf6TevkFpyL AZSg== X-Gm-Message-State: AOAM5339Xa8imam++NHFXBDci9dmRCxiVGnStjU1mA6EN7EQW/pUtlmu nlIG1iC28b8NBuXdWuu2XB1zNGHhVr6FjOuqZXDIfBBibxM= X-Google-Smtp-Source: ABdhPJyzKn4NUMvBXVXY0fuSlAhHR7R0kxpfW9noosOgmiD41rVXvb2uYKoSFrQ9fYr/eAUPGoLbTCBsLsIuhChy0nc= X-Received: by 2002:aa7:c30f:0:b0:419:2af:4845 with SMTP id l15-20020aa7c30f000000b0041902af4845mr6823187edq.296.1647624321081; Fri, 18 Mar 2022 10:25:21 -0700 (PDT) MIME-Version: 1.0 References: <202203162206.7spggyktx63e@alvherre.pgsql> In-Reply-To: From: Zheng Li Date: Fri, 18 Mar 2022 13:25:09 -0400 Message-ID: Subject: Re: Support logical replication of DDLs To: Japin Li Cc: Alvaro Herrera , Dilip Kumar , rajesh.rs0541@gmail.com, PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, Thanks for the quick review! > And, when I try to use git am to apply the patch, it complains: > > $ git am ~/0001-syntax-pg_publication-pg_dump-ddl_replication.patch > Patch format detection failed. git apply works for me. I'm not sure why git am complains. I also created a git branch to make code sharing easier, please try this out: https://github.com/zli236/postgres/tree/ddl_replication > Seems like you forget initializing the *ddl_level_given after entering the > parse_publication_options(), see [1]. > > > + if (*ddl_level_given) > + ereport(ERROR, > + (errcode(ERRCODE_SYNTAX_ERROR), > + errmsg("conflicting or redundant options"))); > > We can use the errorConflictingDefElem() to replace the ereport() to make the > error message more readable. Agreed. Fixed in the latest version. > I also think that ddl = '' isn't a good way to disable DDL replication, how > about using ddl = 'none' or something else? The syntax follows the existing convention of the WITH publish option. For example in CREATE PUBLICATION mypub WITH (publish = '') it means don't publish any DML change. So I'd leave it as is for now. > The test_decoding test case cannot work as expected, see below: ..... > DDL message: transactional: 1 prefix: role: redacted, search_path: "$user", public, sz: 47 content:CREATE TABLE tab1 (id serial unique, data int); > BEGIN > sequence public.tab1_id_seq: transactional:1 last_value: 1 log_cnt: 0 is_called:0 > > Since the DDL message contains the username, and we try to replace the username with 'redacted' to avoid this problem, > > \o | sed 's/role.*search_path/role: redacted, search_path/g' > > However, the title and dash lines may have different lengths for different > usernames. To avoid this problem, how about using a specified username when > initializing the database for this regression test? I don't understand the question, do you have an example of when the test doesn't work? It runs fine for me. > t/002_pg_dump.pl .............. 13/? > # Failed test 'binary_upgrade: should dump CREATE PUBLICATION pub1' > # at t/002_pg_dump.pl line 3916. > # Review binary_upgrade results in /home/px/Codes/postgresql/Debug/src/bin/pg_dump/tmp_check/tmp_test_jgRI ...... > Failed 84/7709 subtests > t/003_pg_dump_with_server.pl .. ok > t/010_dump_connstr.pl ......... ok > > Test Summary Report > ------------------- > t/002_pg_dump.pl (Wstat: 21504 Tests: 7709 Failed: 84) This is fixed in the latest version. I need to remind myself to run make check-world in the future. Regards, Zheng Li