Обсуждение: [Fwd: [Fwd: named constraints]]

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

[Fwd: [Fwd: named constraints]]

От
Merrill Oveson
Дата:

All:

I have the following table:

create table try (
        ordnum int4 primary key,
        type char(3),
        CONSTRAINT type_check CHECK(type in ('bid', 'ord', 'rma'))
);

The named constraint works find here.

However when I do:

> psql ati -c "alter table try drop constraint type_check"

I get:ERROR:  parser: parse error at or near ""

Am I missing something here?

What I'd really like to do is have constraints that are "outside"
the table definition, that way I could add and drop constraints
without having to dump the data out, rebuild the schema
and re-import the data back in.  Is this possible?



Re: [Fwd: [Fwd: named constraints]]

От
Stephan Szabo
Дата:
IIRC, ALTER TABLE ... DROP CONSTRAINT isn't implemented yet,
so that's going to fail in any case.  ADD CONSTRAINT is implemented
for foreign keys (in 7.0) and should be implemented for check
constraints in 7.1.

Stephan Szabo
sszabo@bigpanda.com