Re: Add schema-qualified relnames in constraint error messages.

Поиск
Список
Период
Сортировка
От Jim Nasby
Тема Re: Add schema-qualified relnames in constraint error messages.
Дата
Msg-id 568C92B9.7040300@BlueTreble.com
обсуждение исходный текст
Ответ на Re: Add schema-qualified relnames in constraint error messages.  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Add schema-qualified relnames in constraint error messages.  ("Shulgin, Oleksandr" <oleksandr.shulgin@zalando.de>)
Список pgsql-hackers
On 1/5/16 9:16 PM, Tom Lane wrote:
> Jim Nasby <Jim.Nasby@bluetreble.com> writes:
>> FWIW, I suspect very few people know about the verbosity setting (I
>> didn't until a few months ago...) Maybe psql should hint about it the
>> first time an error is reported in a session.
>
> Actually, what'd be really handy IMO is something to regurgitate the
> most recent error in verbose mode, without making a permanent session
> state change.  Something like
>
> regression=# insert into bar values(1);
> ERROR:  insert or update on table "bar" violates foreign key constraint "bar_f1_fkey"
> DETAIL:  Key (f1)=(1) is not present in table "foo".
> regression=# \saywhat
> ERROR:  23503: insert or update on table "bar" violates foreign key constraint "bar_f1_fkey"
> DETAIL:  Key (f1)=(1) is not present in table "foo".
> SCHEMA NAME:  public
> TABLE NAME:  bar
> CONSTRAINT NAME:  bar_f1_fkey
> LOCATION:  ri_ReportViolation, ri_triggers.c:3326
> regression=#
>
> Not sure how hard that would be to do within psql's current structure.

At first glance, it looks like it just means changing AcceptResult() to 
use PQresultErrorField in addition to PQresultErrorMessage, and stuffing 
the results somewhere. And of course adding \saywhat to the psql parser, 
but maybe someone more versed in psql code can verify that.

If it is that simple, looks like another good beginner hacker task. :)
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Add schema-qualified relnames in constraint error messages.
Следующее
От: Haribabu Kommi
Дата:
Сообщение: Re: Multi-tenancy with RLS