2ndQuadrant / audit-trigger

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

audit_table(regclass) function chokes in v9.2 after running audit.sql to set up #14

Closed koyae closed 9 years ago

koyae commented 9 years ago

This may have to do with the specific configuration I'm using, but I had the following issue:

ERROR:  function quote_ident(regclass) does not exist
LINE 1: ...'DROP TRIGGER IF EXISTS audit_trigger_row ON ' || quote_iden...
                                                             ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
QUERY:  SELECT 'DROP TRIGGER IF EXISTS audit_trigger_row ON ' || quote_ident(target_table)
CONTEXT:  PL/pgSQL function audit.audit_table(regclass,boolean,boolean,text[]) line 7 at EXECUTE statement

The good news is that this was easy to resolve by simply appending ::TEXT to target_table in the places where it's used as an argument to quote_ident().

Platform: PostgreSQL 9.2.13 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-16), 64-bit

It may be that more recent versions have smarter type-coercion or have an overloaded quote_ident() function to handle this, but I'd assume audit-trigger aims to work for all Postgres versions which are still officially under support, which includes 9.2.x until Sep. 2017. If support for different versions doesn't match official support, we should have a note about it in readme.md

jakajancar commented 9 years ago

Ran into the same problem on a fresh 9.4.1 install on Amazon RDS.

ringerc commented 9 years ago

I'll take a look when I get a chance. I must've merged two pull req's that were OK independently but problematic together, without properly reviewing.​ Currently extremely busy with development so it might be a little while.

greuff commented 9 years ago

I am experiencing the same problem on 9.1.

memoz commented 9 years ago

Same on 9.4.2, appending ::TEXT works.

ringerc commented 9 years ago

@memoz Please send a pull request with that change

koyae commented 9 years ago

Just did a git pull and tested again. Merge-commit 05137fa seems to resolve this one. Thanks everyone.