Re: CHECK NO INHERIT syntax

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: CHECK NO INHERIT syntax
Дата
Msg-id 1342844177-sup-4470@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: CHECK NO INHERIT syntax  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: CHECK NO INHERIT syntax  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-hackers
Excerpts from Tom Lane's message of vie jul 20 16:12:05 -0400 2012:
>
> Alvaro Herrera <alvherre@commandprompt.com> writes:
> > True.  I have added an error check at creation time.  Please suggest
> > improved wording for the message:
>
> > alvherre=# create domain positiveint2 as int check (value > 0) no inherit;
> > ERROR:  CHECK constraints for domains cannot be NO INHERIT
>
> I think "CHECK constraints for domains cannot be marked NO INHERIT"
> would be fine.

Thanks.

> >  ConstraintElem:
> > -            CHECK opt_no_inherit '(' a_expr ')' ConstraintAttributeSpec
> > +            CHECK '(' a_expr ')' opt_no_inherit ConstraintAttributeSpec
>
> This doesn't seem to me to meet the principle of least surprise.  Surely
> NO INHERIT ought to be folded into ConstraintAttributeSpec so that it
> acts like other constraint decorations, ie order isn't significant.

Oh, true; that's a bit more involved.  I verified it works correctly to
have a constraint marked NOT VALID NO INHERIT or the other way around.
I haven't checked whether the changes to ConstraintAttributeSpec have
side effects -- I think it's OK but I might be missing something.

Here's a (hopefully) complete patch.

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Вложения

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

Предыдущее
От: Daniele Varrazzo
Дата:
Сообщение: Resetting libpq connections after an app error
Следующее
От: Bruce Momjian
Дата:
Сообщение: 9.2 release schedule