From: | Kris Jurka <books(at)ejurka(dot)com> |
---|---|
To: | Merlin Moncure <merlin(dot)moncure(at)rcsonline(dot)com> |
Cc: | <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: observations about temporary tables and schemas |
Date: | 2003-09-16 23:17:43 |
Message-ID: | Pine.LNX.4.33.0309161858470.30978-100000@leary.csoft.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-interfaces pgsql-odbc |
On Tue, 16 Sep 2003, Merlin Moncure wrote:
> I have been playing with temporary tables a little bit and noticed some
> interesting things.
Something else I've noticed about temp tables is that you are prohibited
from having a permanent table contain a foreign key reference to a temp
table, but you are allowed to reference a permanent table from a temp
table. The triggers don't work correctly when the table is
modified by another backend:
Backend 1:
CREATE TABLE t1(a int PRIMARY KEY);
CREATE TEMP TABLE t2(a int REFERENCES t1 ON DELETE CASCADE);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
Backend 2:
DELETE FROM t1;
Backend 1:
SELECT * FROM t2 WHERE a NOT IN (SELECT a FROM t1);
After some further investigation this problem can also be generated by two
temp tables:
BEGIN;
CREATE TEMP TABLE t3 (a int PRIMARY KEY) ON COMMIT DELETE ROWS;
CREATE TEMP TABLE t4 (a int REFERENCES t3 ON DELETE CASCADE);
INSERT INTO t3 VALUES(1);
INSERT INTO t4 VALUES(1);
COMMIT;
SELECT * FROM t4 WHERE a NOT IN (SELECT a FROM t3);
Kris Jurka
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Conway | 2003-09-17 02:30:22 | locking for unique hash indexes |
Previous Message | Joshua D. Drake | 2003-09-16 22:22:02 | Re: [BUGS] pg_dump/all doesn't output schemas correctly |
From | Date | Subject | |
---|---|---|---|
Next Message | Alberto Cabello Sanchez | 2003-09-17 06:29:12 | Re: ColumnName and ColumnNumber in libpq (C interface) |
Previous Message | Jim Buttafuoco | 2003-09-16 20:42:17 | Re: Trigger updates MS SQL table |
From | Date | Subject | |
---|---|---|---|
Next Message | Mikhail Umorin | 2003-09-16 23:34:25 | Re: Delphi7, ADO, ODBC and PostgreSQL connection problems |
Previous Message | Mikhail Umorin | 2003-09-16 20:40:24 | Delphi7, ADO, ODBC and PostgreSQL connection problems |