Обсуждение: table vs. column constraints

Поиск
Список
Период
Сортировка

table vs. column constraints

От
Tim Wilson
Дата:
Hi everyone,

I'm having trouble understanding when to use table constraints vs.
column ones. I putting together a database to store events in the school
district where I work and that's where the constraint question comes in.
If anyone has a few minutes to kill, I'd love to get some feedback on my
design at http://www.isd197.org/sibley/staff/wilsont/event_product/

You can see it's a work in progress. The more interesting stuff is
toward the bottom of the page.

-Tim

--
Tim Wilson      |   Visit Sibley online:   | Check out:
Henry Sibley HS |  http://www.isd197.org   | http://www.zope.com
W. St. Paul, MN |                          | http://slashdot.org
wilson@visi.com |  <dtml-var pithy_quote>  | http://linux.com


Re: table vs. column constraints

От
Tom Lane
Дата:
Tim Wilson <wilson@isis.visi.com> writes:
> I'm having trouble understanding when to use table constraints vs.
> column ones.

There's no functional difference --- if you have a constraint that only
involves one column, you can write it either way.  Do what seems easier
to understand.

I believe pg_dump will dump all constraints as table constraints, so in
the long run it may not make any difference anyway ;-)

            regards, tom lane