Re: Table definitions using CHECK and DEFAULT
| От | Command Prompt, Inc. |
|---|---|
| Тема | Re: Table definitions using CHECK and DEFAULT |
| Дата | |
| Msg-id | Pine.LNX.4.30.0111041618240.19169-100000@commandprompt.com обсуждение исходный текст |
| Ответ на | Table definitions using CHECK and DEFAULT ("Matthew L. Wirges" <wirges@cerias.purdue.edu>) |
| Список | pgsql-general |
On Sun, 4 Nov 2001, Matthew L. Wirges wrote:
>This line:
>address_type VARCHAR(30) DEFAULT 'unknown' NOT NULL CHECK(address_type
>IN ("unknown", "forged", "proxy", "temporary", "permanent"))
>gives the error:
>psql:IRDB_POSTGRES:69: ERROR: Attribute 'unknown' not found
[snip]
>Is the SQL wrong? Is it just not possible to do this? Or is this a
>possible bug?
No, the problem is that you're specifying string constants with
double-quotes, not single-quotes. ;) Double-quotes are for identifiers,
not constants.
Change it to read like this, and you'll be set:
address_type VARCHAR(30)
DEFAULT 'unknown'
NOT NULL
CHECK(address_type IN
('unknown', 'forged', 'proxy', 'temporary', 'permanent'))
Regards,
Jw.
--
by way of pgsql-general@commandprompt.com
В списке pgsql-general по дате отправления: