Comments (2)
Bind parameters (the values of $1
, $2
etc) are not recorded.
I don't think PostgreSQL offers any SQL-accessible API to get the bind parameters of the current_query()
. Not to mention the limitation that it only shows the top-level query and there may be layers of nesting in triggers, SQL or plpgsql procedures, SPI calls from functions in other languages, etc.
For diagnostic and audit purposes a way to capture bind parameters at the SQL level would certainly be handy. But it'd require a C extension, since it'd need to install a hook at parameter bind time in the executor and capture the parameters there.
I'd be happy to accept a patch that added that, but definitely will not have any time to write one. If it's sufficiently important to you you can contact 2ndQuadrant to get one of the team here to develop such an extension for you on a commercial basis. I'm afraid I won't have time to advise you on the details of how to write it if you want to do it yourself, beyond directing you to parameter bind hooks. You'd probably want to start by reading the pg_stat_statements
extension to examine its hooks use etc - but you won't need all its shared memory handling etc since you'd only be capturing the statement within the current session.
Also check out PgAudit.
I'm closing this issue as it's not a bug and it's not really a viable feature request given the lack of required PostgreSQL core functionality for it. But you can still comment.
from audit-trigger.
Thank you for the thorough and prompt response. The clear answer and follow-up suggestions are greatly appreciated.
from audit-trigger.
Related Issues (20)
- audit_table(regclass) function chokes in v9.2 after running audit.sql to set up HOT 6
- save primary key in a column HOT 6
- How do I use to audit tables in different schemas ? HOT 5
- Adding trigger to user table HOT 1
- Function error when inserting new row. HOT 1
- Query to display the data
- The logged_actions table is not updating HOT 2
- Audit failing with ERROR out of memory HOT 2
- Cannot add tables with CamelCase HOT 2
- auditing changes to tables with hstore columns is not working HOT 1
- storing TG_RELID (oid) is not "portable" across backup/restore HOT 1
- How to store UserName who is Updating the value of a table For Update Trigger?
- Enhancement: View displaying list of tables/schemas for which auditing is enabled HOT 1
- Convert to extension
- Statement only trigger not consistent with ORMs HOT 1
- Recommended security configuration question
- Why do comments say the transaction id "May wrap, but unique paired with action_tstamp_tx" HOT 3
- make CREATE INDEX idempotent
- Normalize client query-level columns to avoid redundancy HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from audit-trigger.