I have a trigger function:
CREATE OR REPLACE FUNCTION \"trigger_deleteUsers\"()
RETURNS trigger AS
$BODY$
BEGIN
INSERT INTO \"DeletedEntities\" (\"uuidKey\",
try this:
TG_TABLE_NAME::regclass::text
I use it with version 9.4 but it should be working from 8.4 up.
Here is your code with this change:
CREATE OR REPLACE FUNCTION "trigger_deleteUsers"()
RETURNS trigger AS
$BODY$
BEGIN
INSERT INTO "DeletedEntities" ("uuidKey", "dateCreated", "dateModified", "dateSynced", "username", "entityName")
VALUES (OLD."uuidKey", OLD."dateCreated", OLD."dateModified", "dateSynced", OLD."username", TG_TABLE_NAME::regclass::text);
RETURN NULL;
END;
$BODY$
LANGUAGE plpgsql;
CREATE TRIGGER "deleteUsers" AFTER DELETE ON "Users" FOR EACH ROW EXECUTE
PROCEDURE "trigger_deleteUsers"();
let me know if it helps!
TG_TABLE_NAME. See the docs for other trigger arguments: http://www.postgresql.org/docs/current/static/plpgsql-trigger.html