X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DE794DB82B for ; Tue, 15 Nov 2005 10:56:53 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40550-04 for ; Tue, 15 Nov 2005 14:56:56 +0000 (GMT) X-Greylist: delayed 13:35:37.846294 by SQLgrey- Received: from TWMAIL.ESNCC.COM (static-66-173-159-28.t1.cavtel.net [66.173.159.28]) by svr1.postgresql.org (Postfix) with ESMTP id 34E25DB817 for ; Tue, 15 Nov 2005 10:56:49 -0400 (AST) Received: from spawar2i8uvlb9 ([150.125.117.63]) by TWMAIL.ESNCC.COM with Microsoft SMTPSVC(5.0.2195.6713); Tue, 15 Nov 2005 09:56:53 -0500 From: "Lane Van Ingen" To: "Magnus Hagander" , Subject: Re: How to Log SELECT Statements Having Errors Date: Tue, 15 Nov 2005 09:53:29 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCE6C7BC6@algol.sollentuna.se> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.181 Importance: Normal X-OriginalArrivalTime: 15 Nov 2005 14:56:53.0809 (UTC) FILETIME=[D1069A10:01C5E9F4] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/120 X-Sequence-Number: 23371 Many thanks for your helpful suggestions .... To answer your question about 'log_statement' not appearing to handle SELECT statements: could be a documentation omission. I got that from version 8.0.1 documentation PDF, p 268, section 16.4.6.3 where 'log_statement(string)' is discussed: http://www.postgresql.org/docs/8.0/static/runtime-config.html#RUNTIME-CONFIG -LOGGING -----Original Message----- From: Magnus Hagander [mailto:mha@sollentuna.net] Sent: Tuesday, November 15, 2005 3:53 AM To: Lane Van Ingen; pgsql-sql@postgresql.org Subject: RE: [SQL] How to Log SELECT Statements Having Errors > We are putting a new application on PostgreSQL 8.0.1 (Windows > 2003); we are coming off of MySQL, and are having a hard time > finding all of the offending SQL calls. > > It would help a great deal if I could log the content of any > SQL calls that fail. Am only interested in SELECT statements. > > Noticed the following: > (1) The PostgreSQL manual says that config parm 'log_statement' does > not appear to handle SELECT statements; true? No. Where did you get that from, perhaps the manual needs to be clearer? The place to look is: http://www.postgresql.org/docs/8.1/static/runtime-config-logging.html#RU NTIME-CONFIG-LOGGING-WHAT set log_statement to 'all' and it will log everything, including SELECTs. But this will include statements that succeed as well, not just those who fails. > (2) Noticed that config parm 'log_min_error_statement' might > do it, but > not sure what each of the DEBUG* and other parameters > will buy me vs ERROR. I want any statement issued by a client > that cannot be executed due to an SQL error of any kind. Yes, if you want to log only queries that fail, log_min_error_statement is the correct switch to use. If you set it to ERROR, you will get a log of every statement that causes an ERROR or FATAL. If you set it to WARNING, you will get a log of every statement that acuses WARNING, ERROR or FATAL. etc etc for the other values. In this case, you'll want ERROR or possibly WARNING. //Magnus