public inbox for pgsql-general@postgresql.org
help / color / mirror / Atom feedFrom: Wei Wang (Fujitsu) <wangw.fnst@fujitsu.com>
To: shveta malik <shveta.malik@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Yu Shi (Fujitsu) <shiy.fnst@fujitsu.com>
Cc: vignesh C <vignesh21@gmail.com>
Cc: Zhijie Hou (Fujitsu) <houzj.fnst@fujitsu.com>
Cc: Ajin Cherian <itsajin@gmail.com>
Cc: Runqi Tian <runqidev@gmail.com>
Cc: Peter Smith <smithpb2250@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: li jie <ggysxcq@gmail.com>
Cc: Dilip Kumar <dilipbalaut@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Japin Li <japinli@hotmail.com>
Cc: rajesh singarapu <rajesh.rs0541@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Zheng Li <zhengli10@gmail.com>
Subject: RE: Support logical replication of DDLs
Date: Mon, 12 Jun 2023 01:47:02 +0000
Message-ID: <OS3PR01MB6275328379FBE5734B4585619E54A@OS3PR01MB6275.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <CAJpy0uDtrxPo127LH3FP-TffynrspPFqhhC7o_GFOMP+2mPtWQ@mail.gmail.com>
References: <CALDaNm3zSxK1g0UTo4RjPR3JEc-vyPzANOnKEKjiW88xtUUdzA@mail.gmail.com>
<CAJpy0uCGnRQnpNVQaApRxqN=9t5VpHRk5b+Mfdf3cqCEW=s+4A@mail.gmail.com>
<OSZPR01MB63102C42A24D59FACF6D9CD6FD4A9@OSZPR01MB6310.jpnprd01.prod.outlook.com>
<CAJpy0uCbwqWj+p_yj1AHyiufzAUv_H29qOaztAXxFoTqZ9WcAw@mail.gmail.com>
<OSZPR01MB6310E0509F229AF2A9414BB1FD499@OSZPR01MB6310.jpnprd01.prod.outlook.com>
<CAJpy0uBwCZCniPR6vh26L+wpSf4xzUN8omUa9DzF-x1CAud_xA@mail.gmail.com>
<CAA4eK1LOr+2O+_pWKTaa0y9vbW6whfm-8-fuBvnS6OBiaR+7TA@mail.gmail.com>
<CAA4eK1LF3EaCSj5iqO0oT1k3ew7YnQbbKEgbzORDAdvdtd+r7w@mail.gmail.com>
<CAJpy0uDtrxPo127LH3FP-TffynrspPFqhhC7o_GFOMP+2mPtWQ@mail.gmail.com>
On Thur, Jun 8, 2023 20:02 PM shveta malik <shveta.malik@gmail.com> wrote:
> Thank You Vignesh for handling (a), Ajin for handling (b), Shi-san and
> Hou-san for contributing in (c).
>
> The new changes are in patch 0001, 0002, 0005 and 0008.
Thanks for updating the patch set.
Here are some comments:
===
For 0002 patch.
1. The typo atop the function EventTriggerTableInitWrite.
```
+/*
+ * Fire table_init_rewrite triggers.
+ */
+void
+EventTriggerTableInitWrite(Node *real_create, ObjectAddress address)
```
s/table_init_rewrite/table_init_write
~~~
2. The new process for "SCT_CreateTableAs" in the function pg_event_trigger_ddl_commands.
With the event trigger created in
test_ddl_deparse_regress/sql/test_ddl_deparse.sql, when creating the table that
already exists with `CreateTableAs` command, an error is raised like below:
```
postgres=# CREATE TABLE IF NOT EXISTS as_select1 AS SELECT * FROM pg_class WHERE relkind = 'r';
postgres=# CREATE TABLE IF NOT EXISTS as_select1 AS SELECT * FROM pg_class WHERE relkind = 'r';
NOTICE: relation "as_select1" already exists, skipping
ERROR: unrecognized object class: 0
CONTEXT: PL/pgSQL function test_ddl_deparse() line 6 at FOR over SELECT rows
```
It seems that we could check cmd->d.ctas.real_create in the function
pg_event_trigger_ddl_commands and return NULL in this case.
===
For 0004 patch.
3. The command tags that are not supported for deparsing in the tests.
```
FOR r IN SELECT * FROM pg_event_trigger_ddl_commands()
-- Some TABLE commands generate sequence-related commands, also deparse them.
WHERE command_tag in ('ALTER FOREIGN TABLE', 'ALTER TABLE',
'CREATE FOREIGN TABLE', 'CREATE TABLE',
'CREATE TABLE AS', 'DROP FOREIGN TABLE',
'DROP TABLE', 'ALTER SEQUENCE',
'CREATE SEQUENCE', 'DROP SEQUENCE')
```
Since foreign table is not supported yet in the current patch set, it seems that
we need to remove "FOREIGN TABLE" related command tag. If so, I think the
following three files need to be modified:
- test_ddl_deparse_regress/sql/test_ddl_deparse.sql
- test_ddl_deparse_regress/t/001_compare_dumped_results.pl
- test_ddl_deparse_regress/t/002_regress_tests.pl
~~~
4. The different test items between meson and Makefile.
It seems that we should keep the same SQL files and the same order of SQL files
in test_ddl_deparse_regress/meson.build and test_ddl_deparse_regress/Makefile.
===
For 0004 && 0008 patches.
5. The test cases in the test file test_ddl_deparse_regress/t/001_compare_dumped_results.pl.
```
# load test cases from the regression tests
-my @regress_tests = split /\s+/, $ENV{REGRESS};
+#my @regress_tests = split /\s+/, $ENV{REGRESS};
+my @regress_tests = ("create_type", "create_schema", "create_rule", "create_index");
```
I think @regress_tests should include all SQL files, instead of just four. BTW,
the old way (using `split /\s+/, $ENV{REGRESS}`) doesn't work in meson.
Regards,
Wang wei
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-general@postgresql.org
Cc: wangw.fnst@fujitsu.com, shveta.malik@gmail.com, amit.kapila16@gmail.com, shiy.fnst@fujitsu.com, vignesh21@gmail.com, houzj.fnst@fujitsu.com, itsajin@gmail.com, runqidev@gmail.com, smithpb2250@gmail.com, tgl@sss.pgh.pa.us, ggysxcq@gmail.com, dilipbalaut@gmail.com, alvherre@alvh.no-ip.org, sawada.mshk@gmail.com, japinli@hotmail.com, rajesh.rs0541@gmail.com, pgsql-hackers@lists.postgresql.org, zhengli10@gmail.com
Subject: RE: Support logical replication of DDLs
In-Reply-To: <OS3PR01MB6275328379FBE5734B4585619E54A@OS3PR01MB6275.jpnprd01.prod.outlook.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox