Talk:Audit trigger 91plus

From PostgreSQL wiki

(Created page with "in the <nowiki>audit_table</nowiki> function you are getting a parameter target_table of type regclass which you cast to text and quote_ident afterwards to use in a dynamic SQL s…")

The audit system doesn't require any changes on rename or structural changes to the audited table, which is nice. To read the data back, you need to take care of this, by suppling a matching record type, thus.

+

--[[User:T.bussmann|T.bussmann]] 18:15, 14 February 2013 (UTC)

Revision as of 18:15, 14 February 2013

in the audit_table function you are getting a parameter target_table of type regclass which you cast to text and quote_ident afterwards to use in a dynamic SQL statement. To my understanding, the quote_ident can be safely removed and should as the current form makes it impossible to use the trigger on anything that needs a fully qualified name (not in search_path)
furthermore, I don't understand why you change the search_path in the middle of the script: SET search_path = pg_catalog, public; Can you explain?

The audit system doesn't require any changes on rename or structural changes to the audited table, which is nice. To read the data back, you need to take care of this, by suppling a matching record type, thus.
--T.bussmann 18:15, 14 February 2013 (UTC)