Re: defer statement logging until after parse

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: defer statement logging until after parse
Date: 2004-03-12 09:49:25
Message-ID: 405187A5.4060906@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Bruce Momjian wrote:

>The problem I see with this patch is that it doesn't print the error
>query on a syntax error. That seems wrong.
>

It does print it. In fact the example I gave below which is from a real
trace shows it being printed. It is just printed after the error message
rather than before.

You solution doesn't appear to address the problem of what to do if they
ask for only DDL and one of those generates a syntax error.

cheers

andrew

>
>I think you should print the query before parsing if they are asking for
>all queries to be logged, and print them after parsing if they want only
>DDL or DDL and data modification queries. I realize that duplicates
>some function calls, but I don't see any other way.
>
>---------------------------------------------------------------------------
>
>Andrew Dunstan wrote:
>
>
>>The attached patch is for review, not application. It defers logging
>>statements until after they have been parsed. There should be no
>>observable difference in behaviour if there is a successful parse, and
>>on error the following traces appear:
>>
>> line:3 ERROR: syntax error at or near "se3d2" at character 1
>> line:4 LOG: parse error in statement: se3d2 aaa;
>>
>>Basically, I want to know that this will not break anything, and if so I
>>will use it as the basis for a selective statement logging facility,
>>based on the command tag(s) of the parsed statement(s), and
>>incorporating Greg Stark's suggesion of a "syntax error" logging level.
>>
>>cheers
>>
>>andrew
>>
>>
>>
>
>
>
>

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2004-03-12 10:03:57 Re: initdb problen
Previous Message Fabien COELHO 2004-03-12 09:41:11 Re: [HACKERS] notice about costly ri checks (3)