2ndQuadrant / audit-trigger

Simple, easily customised trigger-based auditing for PostgreSQL (Postgres). See also pgaudit.
Other
659 stars 241 forks source link

Remove redundant (/harmful) quote_ident #21

Closed dbevacqua closed 5 years ago

dbevacqua commented 8 years ago

This fix allows setting audit trigger on schema-qualified tables not on the search path, e.g.

select audit.audit_table('some_schema.some_table'::regclass) select audit.audit_table('some_schema."some table"'::regclass)

Without it, the whole object name is quote_ident-ed, resulting in errors like:

ERROR: relation "some_schema.some_table" does not exist

The cast from regclass -> text takes care of quoting...

venue=> CREATE SCHEMA test_schema;
CREATE SCHEMA
venue=> CREATE TABLE test_schema."test table"();
CREATE TABLE
venue=> SELECT 'test_schema."test table"'::regclass::text;
-[ RECORD 1 ]------------------
text | test_schema."test table"

(1 row)

so the quote_ident can simply be removed.

mikijov commented 7 years ago

:-) just like previous pull request #20.

ringerc commented 5 years ago

Addressed by another PR