Re: [INTERFACES] Does "constraint" and "check" work in 6.3.2 ?

Поиск
Список
Период
Сортировка
От Thomas G. Lockhart
Тема Re: [INTERFACES] Does "constraint" and "check" work in 6.3.2 ?
Дата
Msg-id 3637E1BF.C9C56EE0@alumni.caltech.edu
обсуждение исходный текст
Ответ на Does "constraint" and "check" work in 6.3.2 ?  (Constantin Teodorescu <teo@flex.ro>)
Список pgsql-interfaces
> I'm wondering if "constraint" and "check" are working !
> I am using PostgreSQL 6.3.2 and this example from man create_table is
> not working for me !
> testdb=> create table emppay (name text not null, wage float4 default
> 10.00)  constraint empcon check (wage > 5.30 and wage <= 30.00), check
> (name <> '');
> ERROR:  parser: parse error at or near "constraint"

The syntax changed slightly (in v6.3 I recall) to conform to SQL92. The
constraint clauses moved to inside the column declaration parens. Try:

create table emppay (
    name text not null,
    wage float4 default 10.00,
    constraint empcon
        check (wage > 5.30 and wage <= 30.00),
    check (name <> '')
);

                   - Tom

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

Предыдущее
От: Peter T Mount
Дата:
Сообщение: Re: [INTERFACES] [Fwd: postgresql JDBC driver question]
Следующее
От: Murad Nayal
Дата:
Сообщение: Re: [INTERFACES] [Fwd: postgresql JDBC driver question]