From: | "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #1295: Problem on trigger |
Date: | 2004-10-26 01:56:11 |
Message-ID: | 20041026015611.C1FE75A1016@www.postgresql.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged online:
Bug reference: 1295
Logged by: shancheng
Email address: sd_shancheng(at)hotmail(dot)com
PostgreSQL version: 8.0 Beta
Operating system: Fedora2
Description: Problem on trigger
Details:
I have a table for test.
CREATE TABLE _test(id int);
Then i insert some records(at least 3 records for obvious result) into the
table:
INSERT INTO _test VALUES(1);
INSERT INTO _test VALUES(2);
INSERT INTO _test VALUES(3);
And below is my testing function and the point where the problem comes from:
CREATE OR REPLACE FUNCTION _test_delete_and_drop()
RETURNS void AS $$
BEGIN
DELETE FROM _test;
DROP TABLE _test;
RETURN;
END;
$$ LANGUAGE plpgsql;
When i run the command:
SELECT _test_delete_and_drop();
The computer responses:
ERROR: relation with OID 1354613 does not exist
CONTEXT: SQL query "DELETE FROM _test"
PL/pgSQL function "_test_delete_and_drop" line 2 at SQL statement
The function is very easy. It just delete the contents of a table and then
drop it.
The reason that i don't drop the table directly is that i need some cleanup
operations. I define several triggers on the table. And when i delete
records, the trigger will be activeted. If i don't drop the records
beforehand, there will be much useless information left in the database. But
i met a very puzzling problem when i do that. So i write the above test case
to find out what the problem is. And to simplify the question, i don't
define triggers for the table.
Could anyone help me?
Thanks very much!
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-10-26 02:06:27 | Re: BUG #1295: Problem on trigger |
Previous Message | Tom Lane | 2004-10-25 21:43:38 | Re: aggregates other than count accpet * |