From: | Ajin Cherian <itsajin(at)gmail(dot)com> |
---|---|
To: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
Cc: | Peter Smith <smithpb2250(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Zheng Li <zhengli10(at)gmail(dot)com>, li jie <ggysxcq(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Japin Li <japinli(at)hotmail(dot)com>, rajesh singarapu <rajesh(dot)rs0541(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Support logical replication of DDLs |
Date: | 2023-02-16 07:54:15 |
Message-ID: | CAFPTHDZUcqQiN2M0tBJKj9NrTVW3WMBFPoe+mmHWL8QWqc3sqQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
On Thu, Feb 9, 2023 at 9:55 PM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
>
> I happened to notice that MINVFUNC in 0003 displays like this
> "fmt": "MINVFUNC==%{type}T",
> in some cases; this appears in the JSON that's emitted by the regression
> tests at some point. How can we detect this kind of thing, so that
> these mistakes become self-evident? I thought the intention of the
> regress module was to run the deparsed code, so the syntax error should
> have become obvious.
>
> ...
>
> Oh, I see the problem. There are two 'fmt' lines for that clause (and
> many others), one of which is used when the clause is not present. So
> there's never a syntax error, because this one never expands other than
> to empty.
>
> AFAICS this defeats the purpose of the 'present' field. I mean, if the
> clause is never to deparse, then why have it there in the first place?
> If we want to have it, then it has to be correct.
>
>
> I think we should design the code to avoid the repetition, because that
> has an inherent risk of typo bugs and such. Maybe we should set forth
> policy that each 'fmt' string should appear in the source code only
> once. So instead of this
>
> + /* MINVFUNC */
> + if (OidIsValid(agg->aggminvtransfn))
> + tmp = new_objtree_VA("MINVFUNC=%{type}T", 1,
> + "type", ObjTypeObject,
> + new_objtree_for_qualname_id(ProcedureRelationId,
> + agg->aggminvtransfn));
> + else
> + {
> + tmp = new_objtree("MINVFUNC==%{type}T");
> + append_bool_object(tmp, "present", false);
> + }
>
> we would have something like
>
> tmp = new_objtree("MINVFUNC=%{type}T");
> if (OidIsValid(agg->aggminvtransfn))
> {
> append_bool_object(tmp, "present", true);
> append...(tmp, "type", new_objtree_for_qualname_id(ProcedureRelationId, agg->aggminvtransfn));
> }
> else
> {
> append_bool_object(tmp, "present", false);
> }
>
I have addressed this by changing similar occurrences accordingly for
instances with bool "present" - true and false.
This has also changed the test output and I have changed the test patch as well.
Mu changes are in patch 0003 and patch 0004.
regards,
Ajin Cherian
Fujitsu Australia
Attachment | Content-Type | Size |
---|---|---|
v70-0001-Infrastructure-to-support-DDL-deparsing.patch | application/octet-stream | 40.8 KB |
v70-0003-Support-DDL-deparse-of-the-rest-commands.patch | application/octet-stream | 200.8 KB |
v70-0004-Introduce-the-test_ddl_deparse_regress-test-modu.patch | application/octet-stream | 47.3 KB |
v70-0005-DDL-messaging-infrastructure-for-DDL-replication.patch | application/octet-stream | 41.2 KB |
v70-0002-Functions-to-deparse-Table-DDL-commands.patch | application/octet-stream | 131.3 KB |
v70-0006-Support-DDL-replication.patch | application/octet-stream | 212.6 KB |
v70-0007-Document-DDL-replication-and-DDL-deparser.patch | application/octet-stream | 40.6 KB |
v70-0008-Allow-replicated-objects-to-have-the-same-owner-.patch | application/octet-stream | 53.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Elbaz | 2023-02-16 09:58:56 | Aggressive vacuum frequency on a table |
Previous Message | Mikhail Balayan | 2023-02-16 06:57:37 | Automatic aggressive vacuum on almost frozen table takes too long |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2023-02-16 07:58:23 | Re: Use pg_pwritev_with_retry() instead of write() in dir_open_for_write() to avoid partial writes? |
Previous Message | Dilip Kumar | 2023-02-16 07:54:08 | Re: DDL result is lost by CREATE DATABASE with WAL_LOG strategy |