Re: subselect in CHECK constraint?
От | Ian Turner |
---|---|
Тема | Re: subselect in CHECK constraint? |
Дата | |
Msg-id | Pine.LNX.4.21.0009040933050.612-100000@crafter.house обсуждение исходный текст |
Ответ на | Re: subselect in CHECK constraint? (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: subselect in CHECK constraint?
|
Список | pgsql-general |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > CHECK (testconstraint(a, b)) Uhhh. I get no errors, but it dosen't work, either. Consider: CREATE FUNCTION testconstraint(int,int) RETURNS bool AS ' BEGIN RETURN (select sum(a) FROM test WHERE b = $2) < 1000; END; ' LANGUAGE 'plpgsql'; CREATE TABLE test (a int, b int, CHECK (testconstraint(a,b))); INSERT INTO test (a,b) VALUES (1100, 1); SELECT * FROM test; Yielding: a | b - ------+--- 1100 | 1 (1 row) which clearly does not satisfy the constraint. Ian -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.1 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE5s8/6fn9ub9ZE1xoRAuiRAKCHh/wWSl7uYzhJGWnc7kc0OxqZogCgpMCN MdTBSXm7w0C4R4Ghh77+8ok= =nik7 -----END PGP SIGNATURE-----
В списке pgsql-general по дате отправления: