I'm trying to record the results of a select statement into a separate table. I need the information selected, the column it was stored in, the table it was stored in, and the query that selected it. Everything I've read so far says that triggers can't trigger from select statements, and they don't have a variable that stores the query it triggered from. I would be happy with partial solutions since my other option is a complicated perl script that has to parse the query statement to figure out where it is looking for the information
Also, my next step is to do the same for as many types of statements as possible, so if anyone knows how to retrieve the insert, update, or delete statement sent to the database from inside the trigger, that would be useful as well. Here is the table I'm trying to fill, in case it is useful create table sql_query_data_log ( id serial, create_ time timestamp DEFAULT now(), query varchar, table text, column text, data varchar );