Re: Re: [patch] Include detailed information about a row failing a CHECK constraint into the error message

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Re: [patch] Include detailed information about a row failing a CHECK constraint into the error message
Дата
Msg-id CA+TgmoYye7_LDjSpSF0ze+ZhOj8YNp58Qh1jM2EutDOKMeVfyQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Re: [patch] Include detailed information about a row failing a CHECK constraint into the error message  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Re: [patch] Include detailed information about a row failing a CHECK constraint into the error message  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Thu, Nov 10, 2011 at 10:05 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Thu, Nov 10, 2011 at 5:40 AM, Jan Kundrát <jkt@flaska.net> wrote:
>>> Would you object to a patch which outputs just the first 8kB of each
>>> column? Having at least some form of context is very useful in my case.
>
>> Well, if we're going to try to emit some context here, I'd suggest
>> that we try to output only the columns implicated in the CHECK
>> constraint, rather than the whole tuple.
>
> I think that's likely to be impractical, or at least much more trouble
> than the feature is worth.  Also, if you might emit only a subset of
> columns, then you have to label them, a la the FK error messages:
>        Key (x,y,z) = (this,that,theother)
> That's going to make the line length problem worse not better.

Depends.  A lot of CHECK constraints may only reference one column:
CHECK (a > 0).  The whole record is likely to be a lot longer than
(a)=(-32768), and frankly tuples without column names aren't that
readable anyway.

I'd argue that to some degree, CHECK constraints, like UNIQUE
constraints, probably tend to be placed primarily on relatively short
columns.  Now, UNIQUE constraints have a hard limitation, because a
too-large value won't fit into an index block.  And certainly you
could do CHECK (document_is_valid_json(mumbleblump)).  But many things
that contain large amounts of text will just be free text fields, they
won't be part of any constraint, and including them will just make
things unreadable.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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

Предыдущее
От: "Albe Laurenz"
Дата:
Сообщение: Re: Disable OpenSSL compression
Следующее
От: Rudyar
Дата:
Сообщение: MPI programming in postgreSQL backend source code