From: | Amit Langote <amitlangote09(at)gmail(dot)com> |
---|---|
To: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
Cc: | Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: adding partitioned tables to publications |
Date: | 2020-03-18 07:33:04 |
Message-ID: | CA+HiwqGVbp0yh-7-FscZiYu1B_CJjaDZRTYkPTjnjpUgSzE6RA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Mar 18, 2020 at 12:06 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> Hi Peter,
>
> On Mon, Mar 16, 2020 at 9:49 PM Peter Eisentraut
> <peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
> >
> > I was trying to extract some preparatory work from the remaining patches
> > and came up with the attached. This is part of your patch 0003, but
> > also relevant for part 0004. The problem was that COPY (SELECT *) is
> > not sufficient when the table has generated columns, so we need to build
> > the column list explicitly.
> >
> > Thoughts?
>
> Thank you for that.
>
> + if (isnull || !remote_is_publishable)
> + ereport(ERROR,
> + (errmsg("table \"%s.%s\" on the publisher is not publishable",
> + nspname, relname)));
>
> Maybe add a one-line comment above this to say it's an "not supposed
> to happen" error or am I missing something? Wouldn't elog() suffice
> for this?
>
> Other than that, looks good.
Wait, the following Assert in copy_table() should now be gone:
Assert(relmapentry->localrel->rd_rel->relkind == RELKIND_RELATION);
because just below it:
/* Start copy on the publisher. */
initStringInfo(&cmd);
- appendStringInfo(&cmd, "COPY %s TO STDOUT",
- quote_qualified_identifier(lrel.nspname, lrel.relname));
+ if (lrel.relkind == RELKIND_RELATION)
+ appendStringInfo(&cmd, "COPY %s TO STDOUT",
+ quote_qualified_identifier(lrel.nspname,
lrel.relname));
+ else
+ {
+ /*
+ * For non-tables, we need to do COPY (SELECT ...), but we can't just
+ * do SELECT * because we need to not copy generated columns.
+ */
By the way, I have rebased the patches, although maybe you've got your
own copies; attached.
--
Thank you,
Amit
Attachment | Content-Type | Size |
---|---|---|
v12-0003-Add-subscription-support-to-replicate-into-parti.patch | application/octet-stream | 18.5 KB |
v12-0002-Some-refactoring-of-logical-worker.c.patch | application/octet-stream | 10.9 KB |
v12-0004-Publish-partitioned-table-inserts-as-its-own.patch | application/octet-stream | 61.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2020-03-18 07:55:25 | Re: Collation versioning |
Previous Message | Michael Paquier | 2020-03-18 06:32:04 | Re: type of some table storage params on doc |