Search Postgresql Archives

Delete trigger and data integrity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux