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 1o6O2q-0007Vw-1K for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Jun 2022 03:07:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o6O2o-0000iH-BZ for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Jun 2022 03:07:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o6O2o-0000i8-0P for pgsql-hackers@lists.postgresql.org; Wed, 29 Jun 2022 03:07:10 +0000 Received: from mail-yw1-x1130.google.com ([2607:f8b0:4864:20::1130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o6O2l-0005fC-W4 for pgsql-hackers@lists.postgresql.org; Wed, 29 Jun 2022 03:07:09 +0000 Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-31780ad7535so135843477b3.8 for ; Tue, 28 Jun 2022 20:07:07 -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=7UbDbwmwp4xptLaZvs/M6EAQmFAlyKIO+YkoiGKSWlE=; b=cYb3zUzCcou2s6CTcvxwjD8SwCHhDScjyewkla8oKWqaGRQhuu4EH21IlFZgD7oIFN z6ZEM5nHNXTVwXtmrM8+PX1e9VFkmzQ1OsNqmqHFgEaWbdY9A8PykAmCPbr0OKDV1YoO WmbAyN5SjqbyCVlsyf7Ifhtm4jxt4V5RNz8IEy23xRhrxwrc6v35pXYU8rLmHlRvEcdm hv//HuVMEwb13lSCi3/CDe/fvwiFgfoQy1H/lbQkuALKmFwunmEtT2OXovPEQTzoiFY1 BKTvfhWUGDWGPBvf7UjXdqlrX/U01fo6lb4Zb0bWQAD2l/HsUrob1ZXF6PzGnvH02p9O vEYw== 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=7UbDbwmwp4xptLaZvs/M6EAQmFAlyKIO+YkoiGKSWlE=; b=KkbU3ttMhmgsVrdRqwr6sjhSgNjNUMsD+GX+sYiK2f588CE74nOqCr258vdX4UgsZx e5bw7jPtpG6cwkmqjZqGxnvBYhnYB4k8uA6CRVH1+uK96lcNSqa3k4aoW/0Ssw1WJToh AYd2y+1QWtvnC+D3BubD11w/tb4WLRYmq/s3HZ+wXDGE8LXwANcUU7ZiQZtU+9rP8yzF ulKHL8c+2VJRkkAprK7zf1lBK3wth1uAui5soLUKPSx6igUE9u+lx2McZNGAMYyR68LX 1FoASLTiIGZ+Wfx3lzTN3gq5Kvbsa5H+rEZMgleEyiihbxu8wkPHWlJLC5A2PpOGR2Cx oUQg== X-Gm-Message-State: AJIora+oJ0xpQNpuwo52UmAgwxHBAq/8gzaHzk0kQuuwQcIPneWvPcwn W0Kf01NvzA5Iqwl9nCiX1bF/jYLDrtvfaaL8ebY= X-Google-Smtp-Source: AGRyM1vdrEolorTmCkW8XYxsPS9bAWeF5rY1KSrNTXBCnBLrnFYR+NsRW0KRtThjACrKHNT+Ynotw/ZaB6Si+wktocs= X-Received: by 2002:a81:ad4a:0:b0:317:b7ba:e74b with SMTP id l10-20020a81ad4a000000b00317b7bae74bmr1543840ywk.223.1656472025921; Tue, 28 Jun 2022 20:07:05 -0700 (PDT) MIME-Version: 1.0 References: <202203162206.7spggyktx63e@alvherre.pgsql> In-Reply-To: From: Amit Kapila Date: Wed, 29 Jun 2022 08:36:54 +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 28, 2022 at 5:43 PM Amit Kapila wrote: > > 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. > After thinking some more on this, it seems the user may want to optionally change some of these attributes, for example, on the subscriber, it may want to associate the table with a different tablespace. I think to address that we can append these additional attributes optionally, say via an additional parameter (append_all_options/append_all_attributes or something like that) in exposed APIs like deparse_utility_command(). -- With Regards, Amit Kapila.