Git Product home page Git Product logo

Comments (2)

ringerc avatar ringerc commented on May 22, 2024

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.

jhm713 avatar jhm713 commented on May 22, 2024

Thank you for the thorough and prompt response. The clear answer and follow-up suggestions are greatly appreciated.

from audit-trigger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.