Re: Supression of NOTICEs with an ERROR

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Supression of NOTICEs with an ERROR
Дата
Msg-id 6331.1013010956@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Supression of NOTICEs with an ERROR  ("Greg Sabino Mullane" <greg@turnstep.com>)
Список pgsql-hackers
"Greg Sabino Mullane" <greg@turnstep.com> writes:
> I'd like some opinions on fixing the following behavior in 
> psql (and postgres in general):

> foobar=> CREATE TABLE foo (bar INTEGER);
> CREATE
> foobar=> CREATE TABLE foo (bar INTEGER UNIQUE);
> NOTICE:  CREATE TABLE / UNIQUE will create implicit index 'foo_bar_key' for table 'foo'
> ERROR:  Relation 'foo' already exists
> turnstep=>

> I think that this notice should not appear in this case, since 
> the ERROR negates the actual table creation. My first question: 
> is this worth pursuing?

I'd argue that it is not broken.  This isn't really different from the
case ofBEGIN;do something provoking a NOTICE;ROLLBACK;
Would you have the system suppress the NOTICE in this case?

Perhaps more to the point, this particular notice might be useful in
figuring out the reason for the failure --- for example, it might be
that the relation name conflict is not on your table name, but on the
name of an implicitly created index or sequence.  So suppressing the
notice might discard valuable information.

Not everyone likes these notices, and so there has been some talk of
a server configuration variable that could be set to make the server
somewhat less chatty.  This is quite independent of whether the command
ultimately succeeds or fails, however.  In any case I doubt that
hacking psql is a rational way to approach the issue; psql can't be
expected to know all about every sort of notice the backend might issue.
        regards, tom lane


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

Предыдущее
От: "Marc G. Fournier"
Дата:
Сообщение: Re: Threaded PosgreSQL server
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: i18n