
Zitat von
akretschmer
Wobei ich sagen muß, daß ich das Verhalten von PG da für suboptimal halte, die Check-Contraints könnten auch erst zum Schluß angelegt werden (ich war eigentlich fest davon überzeugt, daß dies so ist).
Mal sehen, was andere dazu meinen ...
Andreas
Whow, Tom Lane ist mal wieder schnell:
Code:
> test=# create function check_b() returns bool as $$ declare s int; begin select into s sum(i) from b; if s > 3 then return true; else return false; end if; end;$$ language
+plpgsql;
> test=*# create table a (i int check(check_b()));
This is unsupported, and will fail in *many* situations not only
pg_dump. A check constraint is only expected to examine the current
row of its table.
regards, tom lane Andreas
Lesezeichen