Re: logging as inserts - Mailing list pgsql-hackers

From Tom Lane
Subject Re: logging as inserts
Date
Msg-id 10378.1109877805@sss.pgh.pa.us
Whole thread Raw
In response to Re: logging as inserts  (Josh Berkus <josh@agliodbs.com>)
Responses Re: logging as inserts  (Josh Berkus <josh@agliodbs.com>)
List pgsql-hackers
Josh Berkus <josh@agliodbs.com> writes:
>> What would we like the postgresql.conf option to be? I was thinking
>> log_statements_as_inserts = (t/f)

> Nope.   

> log_destination = 'inserts'   #not a new GUC!

That seems a bit bizarre to me.  The facility isn't a new log
destination; what it is is a different way of formatting what's
sent to the log.

> insert_columns = '%u,%d,%r,%p, ... %$'
> #this new GUC would define a list of comma-seperated columns as escape codes 
> defined via the same code set as log_line_prefix.   The only change would be 
> the addition of %$, which would symbolize the "statement" being logged.

I think what you'd probably really want to write is something like

log_message_format = 'INSERT INTO mytab VALUES(%this, %that, ...);'

the point being that otherwise we'll need yet another GUC var to determine
the table name used in the INSERT.  With a suitable set of escape codes
we could probably arrange for the existing behavior to correspond
to a particular value of log_message_format, and then there isn't
anything weird going on here; you are just changing away from a default
format.

I wonder whether this could be defined in a way that lets it replace
log_line_prefix ... otherwise we have to think about the interaction of
the two facilities.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: logging as inserts
Next
From: "Merlin Moncure"
Date:
Subject: unexpected and reproducable crash in pl/pgsql function