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 1p7Cym-000555-OD for pgsql-hackers@arkaria.postgresql.org; Mon, 19 Dec 2022 10:02:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p7Cyl-00027w-A5 for pgsql-hackers@arkaria.postgresql.org; Mon, 19 Dec 2022 10:02:39 +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 1p7Cyk-00027n-VY for pgsql-hackers@lists.postgresql.org; Mon, 19 Dec 2022 10:02:39 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p7Cyd-0004xA-Rt for pgsql-hackers@lists.postgresql.org; Mon, 19 Dec 2022 10:02:37 +0000 Received: by mail-lf1-x12e.google.com with SMTP id y25so12850614lfa.9 for ; Mon, 19 Dec 2022 02:02:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=kMYacEzYYeyX8kg9hxHtYt85GY64aii1mmXNLFAYDNE=; b=eHhEvIJ08RJby4Ogy8/1ZVsucw3YJAlHGWdcIdbtY6Z+BMgjPY1XDkzP1vDtTotnkX umtfoFSbcAURIEclODpCvg92Jt71eMRKC51b0bnHS+r7mFjGZOhR0xCHdPxWjOueyHBm vkEgab46BqHcnyEjBwafOfQDMFEeK+UND7vwHEgZHGw5OSh9b59PyRz/5g+6JGRLQ0C1 yI4P2fHrH1gT5xmAua22+Tlt56rVYwQhjDOAAA75KK8v0A9FYYLQ7iYA66X4+QHZ+zSS 7jQKgZNWNYcM57gu8ufZ9h+oa8Yrr4G8oH1b7Ek20Zj3JPKafDD1hUR79jKFQ4fJnyPD YPsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=kMYacEzYYeyX8kg9hxHtYt85GY64aii1mmXNLFAYDNE=; b=3IIXGJOxIuzCHDKeJD6HFXf8aoFbvC2tokvAG2KXITRkYKXlzTGXGWT7T+78VXIrWZ 5C+kNObHBv79wp+UhsjilCjBp+NKo3GpSM67inNYufaVkx2HPtK6DSw7+5EIcjnovVQ6 y/0p6eVxDKvFKzrjoy8KItBcxpEe9tDmGnQ5ktc6SzEKC4uIpdANsl4BjdvGWRY+5II4 2+plZaz2NaTp+V6KFl0GU9RkvcG5fh3q/MqMKX1441KDuuYmdG4xPgunLoY9sTjSkUuI 4PX78AtDDHIMkjiwyCQVMXTJsJSw25DWoXR+v+X+Ri/rhQvV/hxHGF5mLk+E562tgo/o FosQ== X-Gm-Message-State: ANoB5pmXISs775rl7rsymAuleMF9oYWWjf8Uvc3qVlthjiciov/Kx3IR J45Ske0h9hVImzktV0f8pG+hQi/QqA6cwS9eTWE= X-Google-Smtp-Source: AA0mqf5jjFTCJOfg9d7aKqJ21Lk9i/u/00ng49lAOHShOuQcpZUn6OBy5HbZTEvUe4e+WTfHBtE5RKFfUNv9GSP76fI= X-Received: by 2002:a05:6512:3454:b0:4b5:8240:5bcb with SMTP id j20-20020a056512345400b004b582405bcbmr5926213lfr.388.1671444149446; Mon, 19 Dec 2022 02:02:29 -0800 (PST) MIME-Version: 1.0 References: <20221006171601.6um4ey5idm4h62vf@alvherre.pgsql> In-Reply-To: From: li jie Date: Mon, 19 Dec 2022 18:02:17 +0800 Message-ID: Subject: Re: Support logical replication of DDLs To: vignesh C Cc: Peter Smith , Zheng Li , Ajin Cherian , Dilip Kumar , Alvaro Herrera , "houzj.fnst@fujitsu.com" , Amit Kapila , Masahiko Sawada , Japin Li , rajesh singarapu , PostgreSQL Hackers 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 I have presented some comments below: 1. AT_AddColumn > + tmpobj =3D new_objtree_VA("ADD %{objtype}s %{definition}s", 3, [ IF NOT EXISTS ] is missing here. 2. AT_DropColumn > + tmpobj =3D new_objtree_VA("DROP %{objtype}s %{column}I", 3, [ IF EXISTS ] is missing here. 3. AT_DropConstraint > + tmpobj =3D new_objtree_VA("DROP CONSTRAINT %{constraint}I", 2, [ IF EXISTS ] is missing here. 4. AT_DetachPartition > + tmpobj =3D new_objtree_VA("DETACH PARTITION %{partition_identity}D", 2, [ CONCURRENTLY | FINALIZE ] is missing here. 5. deparse_CreateSeqStmt > + ret =3D new_objtree_VA("CREATE %{persistence}s SEQUENCE %{identity}D %{= definition: }s", 3, [ IF NOT EXISTS ] is missing here. 6. deparse_IndexStmt > + ret =3D new_objtree_VA("CREATE %{unique}s INDEX %{concurrently}s %{if_n= ot_exists}s %{name}I ON %{table}D USING %{index_am}s (%{definition}s)", 7, [ INCLUDE ] and [ ONLY ] are missing here. 7. deparse_RuleStmt > + foreach(cell, actions) > + list =3D lappend(list, new_string_object(lfirst(cell))); if (actions =3D=3D NIL) list =3D lappend(list, new_string_object("NOTHING")); else { foreach(cell, actions) list =3D lappend(list, new_string_object(lfirst(cell))); } 8. AT_AddIndexConstraint > + tmpobj =3D new_objtree_VA("ADD CONSTRAINT %{name}I %{constraint_type}s = USING INDEX %{index_name}I %{deferrable}s %{init_deferred}s", 6, > + "type", ObjTypeString, "add constraint using index", > + "name", ObjTypeString, get_constraint_name(constrOid), > + "constraint_type", ObjTypeString, > + istmt->deferrable ? "DEFERRABLE" : "NOT DEFERRABLE", "constraint_type", ObjTypeString, istmt->primary ? "PRIMARY KEY" : "UNIQUE", 9. regress test Zheng Li =E4=BA=8E2022=E5=B9=B412=E6=9C=8812=E6=97=A5= =E5=91=A8=E4=B8=80 12:58=E5=86=99=E9=81=93=EF=BC=9A > > Hi, > > Attached please find the DDL deparser testing module in the v45-0007 > patch, this testing module is written by Runqi Tian in [1] with minor > modification from myself. I think we can > start adding more tests to the module now that we're getting close to > finish implementing the DDL deparser. > > This testing module ddl_deparse_regress aims to achieve the following > four testing goals for the DDL deparser: > 1. Test that the generated JSON blob is expected using SQL tests. > 2. Test that the re-formed DDL command is expected using SQL tests. > 3. Test that the re-formed DDL command has the same effect as the > original command > by comparing the results of pg_dump, using the SQL tests in 1 and = 2. > 4. Test that any new DDL syntax is handled by the DDL deparser by > capturing and deparsing > DDL commands ran by pg_regress. > > 1 and 2 is tested with SQL tests, by comparing the deparsed JSON blob > and the re-formed command. > 3 is tested with TAP framework in t/001_compare_dumped_results.pl > 4 is tested with TAP framework and pg_regress in 002_regress_tests.pl, > the execution is currently commented out because it will fail due > unimplemented commands in the DDL deparser. > > [1] https://www.postgresql.org/message-id/flat/CAH8n8_jMTunxxtP4L-3tc%3DG= Namg%3Dmg1X%3DtgHr9CqqjjzFLwQng%40mail.gmail.com > The test patch is very useful. I see that the sql case in test_ddl_deparse_regress is similar to the one in test_ddl_deparse. Why don't we merge the test cases in test_ddl_deparse_regress into test_ddl_deparse, as the sql case can be completely reused with the sql files in test_ddl_dep= arse? I believe this will make the tests more comprehensive and reduce redundancy= . Regards, li jie