On Tue, Jun 28, 2022 at 5:43 PM Amit Kapila <amit.kapil...@gmail.com> 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.