Re: CHECK NO INHERIT syntax

Поиск
Список
Период
Сортировка
От David Fetter
Тема Re: CHECK NO INHERIT syntax
Дата
Msg-id 20120719223049.GA1981@fetter.org
обсуждение исходный текст
Ответ на CHECK NO INHERIT syntax  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: CHECK NO INHERIT syntax  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Thu, Jul 19, 2012 at 12:49:37AM +0300, Peter Eisentraut wrote:
> Sorry to raise this once again, but I still find this CHECK NO INHERIT
> syntax to a bit funny.  We are currently using something like
> 
> CHECK NO INHERIT (foo > 0)
> 
> But we already have a different syntax for attaching attributes to
> constraints (NOT DEFERRABLE, NOT VALID,  etc.), so it would make more
> sense to have
> 
> CHECK (foo > 0) NO INHERIT

How about this?
   CHECK (foo > 0) (INHERIT FALSE)   
That leaves an obvious place for other options, which will doubtless
come.  EXPLAIN's options inspired this API design.

> Besides consistency, this makes more sense, because the attribute is a
> property of the constraint as a whole, not of the "checking".

Good point.  The above change preserves this property.

> This would also extend more easily to other constraint types.  For
> example, when unifying CHECK and NOT NULL constraints, as is
> planned, or when allowing inherited unique constraints, as is
> planned further down the road.
> 
> There is also a hole in the current implementation.  Domain
> constraints silently allow NO INHERIT to be specified, even though
> other senseless attributes are rejected.

That's probably a bug.

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


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

Предыдущее
От: Samuel Vogel
Дата:
Сообщение: Re: b-tree index search algorithms
Следующее
От: Tom Lane
Дата:
Сообщение: Re: b-tree index search algorithms