| From: | Yvonne Zannoun <yvonne(dot)zannoun(at)snowflakesoftware(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Delete trigger and data integrity |
| Date: | 2014-05-27 10:25:17 |
| Message-ID: | CAO0x8gtdCvA50fkXZO+t8-ptcOiBgpn_38yOK-1yZPFeC15DbQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hello everyone,
I have this question regarding delete triggers and how it affects data
integrity.
So here goes: I have this trigger which deletes everything before I insert
new rows.
CREATE OR REPLACE FUNCTION delete_records()
RETURNS TRIGGER AS $$
BEGIN
delete from "TABLE";
RETURN NEW;
END;
$$
LANGUAGE plpgsql;
CREATE TRIGGER delete_on_insert
BEFORE INSERT ON "TABLE"
FOR EACH ROW EXECUTE PROCEDURE delete_records();
My question is what happens while this function is executed? Is there any
chance the table can return empty data between the delete and insert
commands? Or does a trigger like this block this possibility somehow?
Thank you
Kind regards,
*Yvonne Zannoun*
--
*Geospatial Technology Company of the Year*
*Read more <http://www.snowflakesoftware.com/2014/05/geospatial-awards/>*
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Albe Laurenz | 2014-05-27 10:35:53 | Re: libpq: indefinite block on poll during network problems |
| Previous Message | Andrej Vanek | 2014-05-27 08:25:29 | hidden junk files in ...data/base/oid/ |