Re: Logical Replication - improve error message while adding tables to the publication in check_publication_add_relation

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Euler Taveira <euler(at)eulerto(dot)com>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, vignesh C <vignesh21(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Logical Replication - improve error message while adding tables to the publication in check_publication_add_relation
Date: 2021-11-15 08:15:39
Message-ID: 3962011c-428c-f0f1-9106-06d75933e536@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 14.11.21 13:18, Bharath Rupireddy wrote:
> PSA v11 patch with 2 APIs with much simpler parameters and small
> function names:
>
> int errdetail_rel(Form_pg_class rd_rel);
> int errdetail_rel_v2(Oid relid, char relkind, char relpersistence);
>
> Please review it.

I think this is not an improvement. It loses the ability of the caller
the specify exactly why a relation is not acceptable. Before, a caller
could say, it's the wrong relkind, or it's the wrong persistence, or
whatever. Now, it just spits out some details about the relation, but
you can't control which. It could easily be wrong, too: AFAICT, this
will complain that a temporary table is not supported, but it could also
be that a table in general is not supported.

In my mind, this leads us back into the mess that we have before
errdetail_relkind_not_supported(): Very detailed error messages that
didn't actually hit the point.

I think a separate errdetail_relpersistence_not_supported() would be a
better solution (assuming there are enough callers to make it worth a
separate function).

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message houzj.fnst@fujitsu.com 2021-11-15 08:17:49 pg_get_publication_tables() output duplicate relid
Previous Message Peter Eisentraut 2021-11-15 08:06:34 Re: Invalid Unicode escape value at or near "\u0000"