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 1o6A6U-0007M6-Aj for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Jun 2022 12:14:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o6A6R-0002JG-Iv for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Jun 2022 12:13:59 +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 1o6A6R-0002J7-8a for pgsql-hackers@lists.postgresql.org; Tue, 28 Jun 2022 12:13:59 +0000 Received: from mail-yw1-x1133.google.com ([2607:f8b0:4864:20::1133]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o6A6O-0003XB-PY for pgsql-hackers@lists.postgresql.org; Tue, 28 Jun 2022 12:13:58 +0000 Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-31780ad7535so114659727b3.8 for ; Tue, 28 Jun 2022 05:13:56 -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=yd7C+hA45jlEGENXL8WeqdcZzzcgMl9MNm2En5ty7ec=; b=dxtx1cSWYiQVuPJyvWK8o53wkPPyXH5kDHfKsPBu78g40QjOOonMk5TA3ZgfvHBHvJ +TagJnlpIIiGUHmmP38kx/MIwghExq8bRwOTZjBSOsxcVc5cnpxwR0UKJsMJQak8fP6C e2SlpAO3iURjlHAvrkTsA8B9BKOHM3/zNUY/h94zREef4hmsGqLVNLDj5W7Tu2MtYZap TLc1R0RpoXsiID9GUI0IxqSRS6Y/NK+GJjX/ku3AnSTZ4UFNfHU64qa29caWhm42/rxo 26Nk0WuIY7EqRXVBBHf9Cj3fBjZvkgX8tuoBg0oERhRVYoU1MI8ki8P/XJlYiD0pmKMo 2RHw== 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=yd7C+hA45jlEGENXL8WeqdcZzzcgMl9MNm2En5ty7ec=; b=azHNLoQGyVogm8nGEI+dBqBSZWhlt63UVX0EewH8ucJm6hFhvnPyvDPeY338LKf+6f uvBRXh/XP8680VYGA3XF11a9PXgp/VJG5FwEP0F/y7wtO9EwG/PzpXUZfi8ccYLYjJos TpVjqfGUg7C1FPPZ+38+VgGGZTwN0f4QWGte4yF4vn0qCxpvP+THBvTaRiCJ6GUXdz/q fn7KITAu99TmD5d9OmRlNVHrsyRt1JwThL/Ykk1br+PphSUAQagtZ7/KvyomgeWkDElc 1SVNclsbwipLM4FOY//faA9ypzIK+Cj5CqpRaUhG0W0QiIOSR3jwzYioojobik8scUzw BWxw== X-Gm-Message-State: AJIora/Y9tcHOTEvg4t2XXiUxEW8MZJzHSfUoyyR3+HT7CssTVP6S37C OD/Jmvrpc2ewoDyDWoKJTkJARiK+xdxPBc+N1Po= X-Google-Smtp-Source: AGRyM1uULmYCzrTV0pa+EaTqOgpJmFKCsvK8e6o5p1ZmsiUsGXmVnW1GmtsHP/Z5xmz263/N0zdmeSpAHVC06vOil8w= X-Received: by 2002:a81:8454:0:b0:31b:d12c:8b07 with SMTP id u81-20020a818454000000b0031bd12c8b07mr9279089ywf.404.1656418435767; Tue, 28 Jun 2022 05:13:55 -0700 (PDT) MIME-Version: 1.0 References: <202203162206.7spggyktx63e@alvherre.pgsql> In-Reply-To: From: Amit Kapila Date: Tue, 28 Jun 2022 17:43:44 +0530 Message-ID: Subject: Re: Support logical replication of DDLs To: "houzj.fnst@fujitsu.com" Cc: Masahiko Sawada , Japin Li , Alvaro Herrera , Dilip Kumar , rajesh singarapu , PostgreSQL Hackers , Zheng Li Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Jun 21, 2022 at 5:49 PM houzj.fnst@fujitsu.com wrote: > > On Monday, June 20, 2022 11:32 AM houzj.fnst@fujitsu.com wrote: > > > > Attach the new version patch set which added support for CREATE/DROP/ATER > Sequence and CREATE/DROP Schema ddl commands which are provided by Ajin > Cherian off list. > Few questions/comments on v9-0001-Functions-to-deparse-DDL-commands =========================================================== 1. +/* + * Similar to format_type_internal, except we return each bit of information + * separately: ... ... +static void +format_type_detailed(Oid type_oid, int32 typemod, + Oid *nspid, char **typname, char **typemodstr, + bool *typarray) The function mentioned in the comments seems to be changed to format_type_extended in commit a26116c6. If so, change it accordingly. 2. It is not clear to me why format_type_detailed needs to use 'peculiar_typmod' label and then goto statement? In format_type_extended, we have similar code but without using the goto statement, so can't we use a similar way here as well? 3. format_type_detailed() { ... + typeform->typstorage != 'p') It is better to replace the constant 'p' with TYPSTORAGE_PLAIN. 4. It seems to me that the handling of some of the built-in types is different between format_type_detailed and format_type_extended. Can we add some comments to explain the same? 5. +static ObjTree * +deparse_CreateStmt(Oid objectId, Node *parsetree) { ... + tmp = new_objtree_VA("TABLESPACE %{tablespace}I", 0); + if (node->tablespacename) + append_string_object(tmp, "tablespace", node->tablespacename); + else + { + append_null_object(tmp, "tablespace"); + append_bool_object(tmp, "present", false); + } + append_object_object(createStmt, "tablespace", tmp); ... } Why do we need to append the objects (tablespace, with clause, etc.) when they are not present in the actual CREATE TABLE statement? The reason to ask this is that this makes the string that we want to send downstream much longer than the actual statement given by the user on the publisher. -- With Regards, Amit Kapila.