Re: getting details about integrity constraint violation

Поиск
Список
Период
Сортировка
От Greg Sabino Mullane
Тема Re: getting details about integrity constraint violation
Дата
Msg-id 93b83a5f4f948719c40b2ecac346c692@biglumber.com
обсуждение исходный текст
Ответ на Re: getting details about integrity constraint violation  (Markus Bertheau <twanger@bluetwanger.de>)
Список pgsql-sql
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


>> Simply name the table constraints yourself with a descriptive name, so you
>> always know exactly what is going on:

> And then I keep a list of all the constraint names and scan the error
> message for it?

Don't keep a list: just come up with a standard naming scheme, such as:

"tablename|colname|is_not_unique"

which should be human and machine parseable (perl example):

if ($error =~ m#^(.+)\|(.+)\|is_not_unique$#o) {       die qq{Whoops : looks like column "$2" of table "$1" needs to be
unique\n};
}

- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200506142204
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iD8DBQFCr4zivJuQZxSWSsgRAgGPAJ0awkoBmus6z1cLBRpsR5xmQPTfiACgpJxG
Ld90hEGDPrebBE3JGGL11L4=
=smQJ
-----END PGP SIGNATURE-----




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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: foreign key on pg_shadow
Следующее
От: "Praveen Raja"
Дата:
Сообщение: update syntax