Re: [Sender Address Forgery]Re: error message when subscription target is a partitioned table

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [Sender Address Forgery]Re: error message when subscription target is a partitioned table
Date: 2019-01-07 08:28:27
Message-ID: 9ea8ba4e-efbd-7117-0e89-3877d3ab20b2@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019/01/07 16:35, Michael Paquier wrote:
> On Mon, Jan 07, 2019 at 01:49:49PM +0900, Amit Langote wrote:
>> {
>> /*
>> - * We currently only support writing to regular tables.
>> + * We currently only support writing to regular tables. However, give
>> + * a more specific error for partitioned and foreign tables.
>> */
>> + if (relkind == RELKIND_PARTITIONED_TABLE)
>> + ereport(ERROR,
>> + (errcode(ERRCODE_WRONG_OBJECT_TYPE),
>> + errmsg("\"%s.%s\" is a partitioned table",
>> + nspname, relname),
>> + errdetail("Partitioned tables are not
>> supported as logical replication targets.")));
>
> Could it be possible to avoid a full sentence in the primary error
> message? Usually these are avoided:
> https://www.postgresql.org/docs/devel/error-style-guide.html
>
> It seems to me that we may want something more like:
> Primary: "could not use \"%s.%s\" as logical replication target".
> Detail: "Relation %s.%s is a foreign table", "not a table", etc.

I've thought about that before and I tend to agree with you. Maybe:

ERROR: cannot use "%s.%s" as logical replication target
DETAIL: Using partitioned tables as logical replication target is not
supported.

Sounds a bit repetitive, but perhaps it's better to use the words "not
supported" in the DETAIL message.

Thanks,
Amit

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mitar 2019-01-07 08:39:00 Re: Implementing Incremental View Maintenance
Previous Message Masahiko Sawada 2019-01-07 08:00:21 Using logical replication with older version subscribers