Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
postgres db trigger to log query type into another table

This problem scenario may sounds strange but I am trying to write a trigger to log the query type into another table and so far i havent been able to find anything on google

the database i am using is postgres

i.e.

if i have two tables; table1 and querylog(has a string field called querytype)

and a select query is executed on table1, i want to insert a row into the query log table with the querytype field populated with "select"

anyone have any idea how to reference the query type in a function that will be called by a trigger?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Triggers do not get called for SELECT queries, so that won't work.

If you want to audit queries, you can use the PostgreSQL log file or tools like pgaudit that hook into PostgreSQL to retrieve and log the information.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!