Getting bind variables from log file

From: "Nigel Bishop" <Nigel(dot)Bishop(at)ioko(dot)com>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: Getting bind variables from log file
Date: 2006-11-20 14:01:31
Message-ID: 72558D9A7573814BB4082A28843E03D403B27E7B@intyodc01.uk.ioko365.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,

PG 8.1.4

O/S Solaris 8

I was wondering whether it's possible to get the value of the bind
variables in the PG log file

We have an app that's failing:

2006-11-15 12:50:15 GMTSTATEMENT: BEGIN

2006-11-15 12:50:15 GMTLOG: 00000: statement: PREPARE <unnamed> AS
SELECT displayname, stringvalue, datatype, siteid, datereceived,

file, intvalue FROM file_head INNER JOIN file_body USING (fileid) INNER
JOIN metric_references USING (reference) WHERE datereceived

BETWEEN DATE $1 AND DATE $2 AND siteid IN ($3) AND reference IN ($4)
ORDER BY datereceived, displayname, file, siteid

2006-11-15 12:50:15 GMTLOCATION: exec_parse_message, postgres.c:1153

2006-11-15 12:50:15 GMTSTATEMENT: SELECT displayname, stringvalue,
datatype, siteid, datereceived, file, intvalue FROM file_head IN

NER JOIN file_body USING (fileid) INNER JOIN metric_references USING
(reference) WHERE datereceived BETWEEN DATE $1 AND DATE $2 AND

siteid IN ($3) AND reference IN ($4) ORDER BY datereceived,
displayname, file, siteid

2006-11-15 12:50:15 GMTDEBUG: 00000: StartTransactionCommand

2006-11-15 12:50:15 GMTLOCATION: start_xact_command, postgres.c:1983

2006-11-15 12:50:15 GMTSTATEMENT: SELECT displayname, stringvalue,
datatype, siteid, datereceived, file, intvalue FROM file_head IN

NER JOIN file_body USING (fileid) INNER JOIN metric_references USING
(reference) WHERE datereceived BETWEEN DATE $1 AND DATE $2 AND

siteid IN ($3) AND reference IN ($4) ORDER BY datereceived,
displayname, file, siteid

2006-11-15 12:50:15 GMTERROR: 42601: syntax error at or near "$1" at
character 211

2006-11-15 12:50:15 GMTLOCATION: yyerror, scan.l:770

2006-11-15 12:50:15 GMTSTATEMENT: SELECT displayname, stringvalue,
datatype, siteid, datereceived, file, intvalue FROM file_head IN

NER JOIN file_body USING (fileid) INNER JOIN metric_references USING
(reference) WHERE datereceived BETWEEN DATE $1 AND DATE $2 AND

siteid IN ($3) AND reference IN ($4) ORDER BY datereceived,
displayname, file, siteid

2006-11-15 12:50:15 GMTDEBUG: 00000: StartTransactionCommand

2006-11-15 12:50:15 GMTLOCATION: start_xact_command, postgres.c:1983

2006-11-15 12:50:15 GMTDEBUG: 00000: StartTransaction

Running the SQL at the prompt is fine using the date format 'YYYY-MM-DD'

I set the following params in the conf file and although if kicks out a
lot of info it doesn't show the values for the bind variables

client_min_messages = debug5

log_min_messages = debug5

log_error_verbosity = verbose

log_min_error_statement = debug5

log_min_duration_statement = 0

log_statement = 'all'

Can someone point out where I'm going wrong?

Thanks,

Nigel

Communications on or through ioko's computer systems may be monitored or recorded to secure effective system operation and for other lawful purposes.

Unless otherwise agreed expressly in writing, this communication is to be treated as confidential and the information in it may not be used or disclosed except for the purpose for which it has been sent. If you have reason to believe that you are not the intended recipient of this communication, please contact the sender immediately. No employee is authorised to conclude any binding agreement on behalf of ioko with another party by e-mail without prior express written confirmation.

ioko365 Ltd. VAT reg 656 2443 31. Reg no 3048367. All rights reserved.

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Bruce Momjian 2006-11-20 21:28:38 Re: Getting bind variables from log file
Previous Message jose fuenmayor 2006-11-20 13:21:20 Settings for writing!