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 1ppLBF-0002Nc-Lc for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Apr 2023 03:41:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ppLBD-000546-Ly for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Apr 2023 03:41:55 +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 1ppLBD-00053x-8c for pgsql-hackers@lists.postgresql.org; Thu, 20 Apr 2023 03:41:55 +0000 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ppLB6-000o8c-ID for pgsql-hackers@lists.postgresql.org; Thu, 20 Apr 2023 03:41:54 +0000 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-2fddb442d47so246959f8f.2 for ; Wed, 19 Apr 2023 20:41:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681962106; x=1684554106; 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=6Fig/TtHVFSG3o4tjWEMQBVpNW/N5wMx/TiGuHkFexY=; b=c6Myp2mIdZFrAlFuIBkVVjNbYchOsABcmSP/tyIl6YrDH5fAeVE8wU/6PZdkjlln23 /6b6IxBoqQEZ3dJbhG3nV+ZbYy91z7ElHAJD04Izoz1qofyrXKSAHI4/eofktinyDmnE 81lmzIv69BH2lJGHoBFP1uqNVQ/ln7MvkSQcKsSY191KAEVS9TX0Frtzq5qZqOUmOAz5 BzV/+db4QNpkfRmEGg8OqDZYKzpbvUipPc6qoDRAszOXyeaZ+5J4ycnOtokCK9WW+nti IIElkTr2qwRMAxT6ZeKn0BiKYzwvHPv2EqXDm8yFkRLHuT9bXU7qSOxmYwgvCMGb4k+R cIJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681962106; x=1684554106; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6Fig/TtHVFSG3o4tjWEMQBVpNW/N5wMx/TiGuHkFexY=; b=hwE+koe32bCcX0UeQ6FZv481dhJlQIr/dxsY5TOpBXNegx6+wmfltzymeQIA8y41KE U4i8TZWGv1Zx7nMfz2CqLC8UmBwP9hDCh635TZNA3K70JojDb0xyXqpmLfNHuScNPS+m BMIpHNrAv3aSJFrQN6N0VX21L9kWPjc7kzUWeoIOMKygy25kjEQa25Ro2JshoKerlvqR 6E3hKiyTUVaVKTITlfihmsp2NMfQ4qT4Rs1oQcA+5s8x5lJYpUJ7LtDS17NftiLfIaMU wTDMQr/LDmQh3usZmSf1aOH5yYuGKSyk0FZWLqNmhQLXm6iqwArdaaKD9Qw+eE23bNmW 9Xnw== X-Gm-Message-State: AAQBX9efVqiVnu1kc5K5g39a8A4eJtDtCmH4tK+eWgQlJvM0AsIsBG0y sXBjOVuYe4cgaPrl9iqg1BaXy4gegldeEZyrJGU= X-Google-Smtp-Source: AKy350agL+A0pbataAP67QfE3PBeBK9OtRAXoR05oTdiKJBD5Iy3DggGu6pye7ick1zqaOR1VsM/OWx8v/2WfStE7Oc= X-Received: by 2002:adf:e38d:0:b0:2d9:81b2:322a with SMTP id e13-20020adfe38d000000b002d981b2322amr7016wrm.55.1681962106398; Wed, 19 Apr 2023 20:41:46 -0700 (PDT) MIME-Version: 1.0 References: <3032112.1679865718@sss.pgh.pa.us> In-Reply-To: From: shveta malik Date: Thu, 20 Apr 2023 09:11:34 +0530 Message-ID: Subject: Re: Support logical replication of DDLs To: "Zhijie Hou (Fujitsu)" Cc: Amit Kapila , vignesh C , Ajin Cherian , "Wei Wang (Fujitsu)" , Runqi Tian , Peter Smith , Tom Lane , li jie , Dilip Kumar , Alvaro Herrera , Masahiko Sawada , Japin Li , rajesh singarapu , PostgreSQL Hackers , Zheng Li , shveta malik 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 Mon, Apr 17, 2023 at 5:32=E2=80=AFPM Zhijie Hou (Fujitsu) wrote: > > On Monday, April 10, 2023 7:20 PM Amit Kapila w= rote: > > > > On Fri, Apr 7, 2023 at 8:52=E2=80=AFAM houzj.fnst@fujitsu.com > > wrote: > > > > > > Sorry, there was a miss when rebasing the patch which could cause the > > > CFbot to fail and here is the correct patch set. > > > > > > > I see the following note in the patch: "Note: For ATTACH/DETACH PARTITI= ON, > > we haven't added extra logic on the subscriber to handle the case where= the > > table on the publisher is a PARTITIONED TABLE while the target table on= the > > subscriber side is a NORMAL table. We will research this more and impro= ve it > > later." and wonder what should we do about this. I can think of the fol= lowing > > possibilities: (a) Convert a non-partitioned table to a partitioned one= and then > > attach the partition; (b) Add the partition as a separate new table; (c= ) give an > > error that table types mismatch. For Detach partition, I don't see much > > possibility than giving an error that no such partition exists or somet= hing like > > that. Even for the Attach operation, I prefer (c) as the other options = don't seem > > logical to me and may add more complexity to this work. > > > > Thoughts? > > I also think option (c) makes sense and is same as the latest patch's beh= avior. > > Attach the new version patch set which include the following changes: > Few comments for ddl_deparse.c in patch dated April17: 1) append_format_string() I think we need to have 'Assert(sub_fmt)' here like we have it in all other similar functions (append_bool_object, append_object_object, ...) 2) append_object_to_format_string() here we have code piece : if (sub_fmt =3D=3D NULL || tree->fmtinfo =3D=3D NULL) return sub_fmt; but sub_fmt will never be null when we reach this function as all its callers assert for null sub_fmt. So that means when tree->fmtinfo is null, we end up returning sub_fmt as it is, instead of extracting object name from that. Is this intended? 3) We can remove extra spaces after full-stop in the comment below /* * Deparse a ColumnDef node within a typed table creation. This is simpler * than the regular case, because we don't have to emit the type declaratio= n, * collation, or default. Here we only return something if the column is b= eing * declared NOT NULL. ... deparse_ColumnDef_typed() 4) These functions are not being used, do we need to retain these in this p= atch? deparse_Type_Storage() deparse_Type_Receive() deparse_Type_Send() deparse_Type_Typmod_In() deparse_Type_Typmod_Out() deparse_Type_Analyze() deparse_Type_Subscript() 5) deparse_AlterRelation() We have below variable initialized to false in the beginning 'bool istype =3D false;' And then we have many conditional codes using the above, eg: istype ? "ATTRIBUTE" : "COLUMN". We are not changing 'istype' anywhere and it is hard-coded in the beginning. It means there are parts of code in this function which will never be htt (written for 'istype=3Dtrue' case) , so why do we need this variable and conditional code around it? 6) There are plenty of places where we use 'append_not_present' without using 'append_null_object'. Do we need to have 'append_null_object' along with 'append_not_present' at these places? 7) deparse_utility_command(): Rather than inject --> Rather than injecting thanks Shveta