Re: Logical Replication - detail message with names of missing columns

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Logical Replication - detail message with names of missing columns
Date: 2020-09-08 17:06:17
Message-ID: CALj2ACU6Oo4jcNGZ9C8MPj6OeUYfYg9yJEhK0ECEssxoXhSojw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks for the comments. Attaching the v3 patch.

On Tue, Sep 8, 2020 at 8:19 PM Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote:
>
> This looks a bit fiddly. Would it be less cumbersome to use
> quote_identifier here instead?
>

Changed. quote_identifier() adds quotes wherever necessary.

>
> Please do use errmsg_plural -- have the new function return the number
> of missing columns. Should be pretty straightforward.
>

Changed. Now the error message looks as below:

CREATE TABLE test_tbl1(a1 int, b1 text, c1 int, d1 real, e1 int);
ERROR: logical replication target relation "public.test_tbl1" is
missing replicated column:c1
ERROR: logical replication target relation "public.test_tbl1" is
missing replicated columns:b1,c1
ERROR: logical replication target relation "public.test_tbl1" is
missing replicated columns:b1,c1,e1

CREATE TABLE test_tbl1("!A1" int, "%b1" text, "@C1" int, d1 real, E1 int);
ERROR: logical replication target relation "public.test_tbl1" is
missing replicated column:"@C1"
ERROR: logical replication target relation "public.test_tbl1" is
missing replicated columns:"@C1",d1
ERROR: logical replication target relation "public.test_tbl1" is
missing replicated columns:"!A1","@C1",d1
ERROR: logical replication target relation "public.test_tbl1" is
missing replicated columns:"!A1","@C1",d1,e1
ERROR: logical replication target relation "public.test_tbl1" is
missing replicated columns:"!A1","%b1","@C1",d1,e1

With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
v3-0001-Detail-message-with-names-of-missing-columns-in-l.patch application/octet-stream 3.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message James Coleman 2020-09-08 17:17:48 Re: Nicer error when connecting to standby with hot_standby=off
Previous Message Alexey Kondratov 2020-09-08 17:00:44 Re: Global snapshots