Re: Shouldn't duplicate addition to publication be a no-op?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Shouldn't duplicate addition to publication be a no-op?
Date: 2017-04-13 12:33:52
Message-ID: 11698.1492086832@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> writes:
> I wonder if trying to add a relation to a publication that it is already a
> part should be considered a no-op, instead of causing an error (which
> happens in the ALTER PUBLICATION ADD TABLES case).

On what grounds?

The equivalent case for inheritance is an error:

regression=# create table foo (a int);
CREATE TABLE
regression=# create table bar () inherits (foo);
CREATE TABLE
regression=# alter table bar inherit foo;
ERROR: relation "foo" would be inherited from more than once

(Your example purporting to show the contrary contains a typo.)

If there's a reason why this case should act differently from that
precedent, you haven't shown it.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2017-04-13 12:37:08 Re: pg_statistic_ext.staenabled might not be the best column name
Previous Message Yorick Peterse 2017-04-13 12:29:33 Re: [PATCH] Document the order of changing certain settings when using hot-standby servers