Re: [GENERAL] why it doesn't work? referential integrity

2007-08-17 Thread Janning Vygen
On Saturday 11 August 2007 12:28:45 Pavel Stehule wrote: Hello I found strange postgresql's behave. Can somebody explain it? Regards Pavel Stehule CREATE TABLE users ( id integer NOT NULL, name VARCHAR NOT NULL, PRIMARY KEY (id) ); INSERT INTO users VALUES (1, 'Jozko'); INSERT

Re: [GENERAL] why it doesn't work? referential integrity

2007-08-17 Thread Pavel Stehule
looks strange to me too, but i never had foreign keys to the same table. it works if you define your chekced_by FK deferrable with checked_by INT REFERENCES users (id) ON UPDATE CASCADE ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, it seams that postgresql does its job in a procedural

[GENERAL] why it doesn't work? referential integrity

2007-08-11 Thread Pavel Stehule
Hello I found strange postgresql's behave. Can somebody explain it? Regards Pavel Stehule CREATE TABLE users ( id integer NOT NULL, name VARCHAR NOT NULL, PRIMARY KEY (id) ); INSERT INTO users VALUES (1, 'Jozko'); INSERT INTO users VALUES (2, 'Ferko'); INSERT INTO users VALUES (3,

Re: [GENERAL] why it doesn't work? referential integrity

2007-08-11 Thread Gregory Stark
Pavel Stehule [EMAIL PROTECTED] writes: checked_by INT REFERENCES users (id) ON UPDATE CASCADE ON DELETE SET NULL, CONTEXT: SQL statement UPDATE ONLY public.tasks SET worker = NULL WHERE $1 OPERATOR(pg_catalog.=) worker This says you mistyped the constraint above to refer to

Re: [GENERAL] why it doesn't work? referential integrity

2007-08-11 Thread Pavel Stehule
2007/8/11, Gregory Stark [EMAIL PROTECTED]: Pavel Stehule [EMAIL PROTECTED] writes: checked_by INT REFERENCES users (id) ON UPDATE CASCADE ON DELETE SET NULL, CONTEXT: SQL statement UPDATE ONLY public.tasks SET worker = NULL WHERE $1 OPERATOR(pg_catalog.=) worker This says you

Re: [GENERAL] why it doesn't work? referential integrity

2007-08-11 Thread Gregory Stark
Sorry, I reread your original post. My initial reading was wrong. To make this work I think you'll need to set these constraints to be deferred. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com ---(end of broadcast)--- TIP

Re: [GENERAL] why it doesn't work? referential integrity

2007-08-11 Thread Pavel Stehule
2007/8/11, Gregory Stark [EMAIL PROTECTED]: Sorry, I reread your original post. My initial reading was wrong. To make this work I think you'll need to set these constraints to be deferred. -- it works with deferred constraints . It's strange, it works with two columns but dowsn't work with

Re: [GENERAL] why it doesn't work? referential integrity

2007-08-11 Thread Gregory Stark
Pavel Stehule [EMAIL PROTECTED] writes: 2007/8/11, Gregory Stark [EMAIL PROTECTED]: Pavel Stehule [EMAIL PROTECTED] writes: checked_by INT REFERENCES users (id) ON UPDATE CASCADE ON DELETE SET NULL, CONTEXT: SQL statement UPDATE ONLY public.tasks SET worker = NULL WHERE $1

Re: [GENERAL] why it doesn't work? referential integrity

2007-08-11 Thread Stephan Szabo
On Sat, 11 Aug 2007, Pavel Stehule wrote: Hello I found strange postgresql's behave. Can somebody explain it? There's a bug since it should work for any number, but we've likely missed something. I'm not sure why 2 references work, as I'd expect it to stop working after 1 with the likely

Re: [GENERAL] why it doesn't work? referential integrity

2007-08-11 Thread Pavel Stehule
2007/8/11, Stephan Szabo [EMAIL PROTECTED]: On Sat, 11 Aug 2007, Pavel Stehule wrote: Hello I found strange postgresql's behave. Can somebody explain it? There's a bug since it should work for any number, but we've likely missed something. I'm not sure why 2 references work, as I'd