Re: CHECK() Constraint on Column Using Lookup Table

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: CHECK() Constraint on Column Using Lookup Table
Date: 2007-05-01 17:55:34
Message-ID: 507395.88992.qm@web31812.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


--- Rich Shepard <rshepard(at)appl-ecosys(dot)com> wrote:

> I've seen the syntax for using a lookup table in a CHECK() constraint, but
> I cannot find a reference to it. It's not in Section 5.3.1 of the 8.2 docs.
>
> Specifically, I want to reference a table of ISO 2-letter codes for US
> states and Canadian provinces/territories in a table with name and address
> columns.

Using sub-queries in a table DDL is legal per SQL92, but Postgresql doesn't support this syntax.
However, I don't see what you would need it since the "REFERENCES" predicate should work just fine
for you.

You can scroll down to the passages that discuss the check constraint from the following page:
http://www.postgresql.org/docs/8.2/interactive/sql-createtable.html

Regards,
Richard Broersma Jr.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2007-05-01 18:03:02 Re: CHECK() Constraint on Column Using Lookup Table
Previous Message Joshua D. Drake 2007-05-01 17:53:59 Re: CHECK() Constraint on Column Using Lookup Table