Re: Error message inconsistency

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, MBeena Emerson <mbeena(dot)emerson(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Error message inconsistency
Date: 2020-01-24 05:21:49
Message-ID: CAA4eK1KTdFmPQwJcE_mJjOSAoix_Kmv25D8xm_NTze=R8qHg8Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 23, 2020 at 5:51 PM Mahendra Singh Thalor
<mahi6run(at)gmail(dot)com> wrote:
>
> I fixed above comment and updated expected .out files. Attaching
> updated patches.
>

LGTM. I have combined them into the single patch. What do we think
about backpatching this? As there are quite a few changes in the
regression tests, so it might be a good idea to keep the back branches
code in sync, but, OTOH, this is more of a change related to providing
more information, so we don't have any pressing need to backpatch
this. What do others think?

One thing to note is that there are places in code where we use
'table' instead of 'relation' for the same thing in the error messages
as seen in the below places (the first one uses 'relation', the second
one uses 'table') and the patch is using 'relation' which I think is
fine.

1. src/backend/executor/execPartition.c
342 ereport(ERROR,
343 (errcode(ERRCODE_CHECK_VIOLATION),
344 errmsg("no partition of relation \"%s\"
found for row",
345 RelationGetRelationName(rel)),
346 val_desc ?
347 errdetail("Partition key of the failing row
contains %s.",
348 val_desc) : 0));

2. src/backend/commands/typecmds.c
2396 ereport(ERROR,
2397 (errcode(ERRCODE_NOT_NULL_VIOLATION),
2398 errmsg("column \"%s\" of table
\"%s\" contains null values",
2399 NameStr(attr->attname),
2400 RelationGetRelationName(testrel)),
2401 errtablecol(testrel, attnum)));

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
v5-0001-Added-relation-name-in-error-messages-for-constraint.patch application/octet-stream 37.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-01-24 05:50:54 Re: [Patch] pg_rewind: options to use restore_command from recovery.conf or command line
Previous Message Pavel Stehule 2020-01-24 05:08:45 Re: proposal: schema variables