Re: [HACKERS] Proposed GUC Variable

Lists: pgsql-hackerspgsql-patches
From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Proposed GUC Variable
Date: 2002-08-23 02:04:50
Message-ID: GNELIHDDFBOCMGBFGEFOEENICDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Hi,

My primary use of Postgres is as the backend database for a busy web site.
We have a cron job that just emails us the tail of our database, php, apache
logs every night. That way we can see some problems.

These logs almost always contain some errors. For instance, this is what I
see at the moment:

2002-08-22 19:21:57 ERROR: pg_atoi: error in "334 - 18k": can't parse " -
18k"

Now there's plenty of places that accept numeric input in the site and
obviously there's a bug in some script somewhere that's not filtering the
input properly or something. However - the error message above is useless
to me!!!

So, what I'd like to propose is a new GUC variable called
'debug_print_query_on_error' or something. Instead of turning on
debug_print_query and having my logs totally spammed up with sql, this GUC
variable would only print the query if an actual ERROR occurred. This way I
could nail the error very quickly by simply finding the query in my
codebase.

Is this possible? At the stage of processing where the elog(ERROR) occurs,
do we still have access to the original query string?

Comments?

Chris


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-23 02:46:31
Message-ID: 200208230246.g7N2kVP24851@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Someone asked for that recently, and the email is in my mailbox for
consideration. I think it is a great idea, and we have
debug_query_string that holds the current query. You could grab that
from elog.c. Added to TODO:

* Add GUC parameter to print queries that generate errors

---------------------------------------------------------------------------

Christopher Kings-Lynne wrote:
> Hi,
>
> My primary use of Postgres is as the backend database for a busy web site.
> We have a cron job that just emails us the tail of our database, php, apache
> logs every night. That way we can see some problems.
>
> These logs almost always contain some errors. For instance, this is what I
> see at the moment:
>
> 2002-08-22 19:21:57 ERROR: pg_atoi: error in "334 - 18k": can't parse " -
> 18k"
>
> Now there's plenty of places that accept numeric input in the site and
> obviously there's a bug in some script somewhere that's not filtering the
> input properly or something. However - the error message above is useless
> to me!!!
>
> So, what I'd like to propose is a new GUC variable called
> 'debug_print_query_on_error' or something. Instead of turning on
> debug_print_query and having my logs totally spammed up with sql, this GUC
> variable would only print the query if an actual ERROR occurred. This way I
> could nail the error very quickly by simply finding the query in my
> codebase.
>
> Is this possible? At the stage of processing where the elog(ERROR) occurs,
> do we still have access to the original query string?
>
> Comments?
>
> Chris
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-23 03:39:35
Message-ID: Pine.LNX.4.21.0208231331180.5340-100000@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Hi all,

Quick hack while eating a sandwich.

template1=# select * frum;
ERROR: parser: parse error at or near "frum" at character 10
ERROR QUERY: select * frum;

Now, I did say quick hack. 'ERROR QUERY' isn't a new error level I just
strcat() it to buf_msg in elog() if debug_print_error_query is
true. Question: from Chris's request it doesn't sound like there is much
use writing this to the client. Does everyone else feel the same way?

If so, I'll patch it up and send off.

Gavin

On Thu, 22 Aug 2002, Bruce Momjian wrote:

>
> Someone asked for that recently, and the email is in my mailbox for
> consideration. I think it is a great idea, and we have
> debug_query_string that holds the current query. You could grab that
> from elog.c. Added to TODO:
>
> * Add GUC parameter to print queries that generate errors
>
> ---------------------------------------------------------------------------
>
> Christopher Kings-Lynne wrote:
> > Hi,
> >
> > My primary use of Postgres is as the backend database for a busy web site.
> > We have a cron job that just emails us the tail of our database, php, apache
> > logs every night. That way we can see some problems.
> >
> > These logs almost always contain some errors. For instance, this is what I
> > see at the moment:
> >
> > 2002-08-22 19:21:57 ERROR: pg_atoi: error in "334 - 18k": can't parse " -
> > 18k"
> >
> > Now there's plenty of places that accept numeric input in the site and
> > obviously there's a bug in some script somewhere that's not filtering the
> > input properly or something. However - the error message above is useless
> > to me!!!
> >
> > So, what I'd like to propose is a new GUC variable called
> > 'debug_print_query_on_error' or something. Instead of turning on
> > debug_print_query and having my logs totally spammed up with sql, this GUC
> > variable would only print the query if an actual ERROR occurred. This way I
> > could nail the error very quickly by simply finding the query in my
> > codebase.
> >
> > Is this possible? At the stage of processing where the elog(ERROR) occurs,
> > do we still have access to the original query string?
> >
> > Comments?
> >
> > Chris
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 4: Don't 'kill -9' the postmaster
> >
>
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-23 04:20:19
Message-ID: 16699.1030076419@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Someone asked for that recently, and the email is in my mailbox for
> consideration. I think it is a great idea, and we have
> debug_query_string that holds the current query.

debug_query_string doesn't necessarily have a lot to do with the
proximate cause of the error. Consider queries issued by rules,
triggers, plpgsql functions, etc.

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-23 04:24:59
Message-ID: 200208230424.g7N4OxA28610@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Someone asked for that recently, and the email is in my mailbox for
> > consideration. I think it is a great idea, and we have
> > debug_query_string that holds the current query.
>
> debug_query_string doesn't necessarily have a lot to do with the
> proximate cause of the error. Consider queries issued by rules,
> triggers, plpgsql functions, etc.

Maybe. I think giving the user the string that caused the error is
probably what they want, rather than a rule or trigger that they can't
tie back to an actual query.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-23 04:26:52
Message-ID: GNELIHDDFBOCMGBFGEFOMENKCDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

> > debug_query_string doesn't necessarily have a lot to do with the
> > proximate cause of the error. Consider queries issued by rules,
> > triggers, plpgsql functions, etc.
>
> Maybe. I think giving the user the string that caused the error is
> probably what they want, rather than a rule or trigger that they can't
> tie back to an actual query.

Yeah, I'd agree with that.

Chris


From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Gavin Sherry" <swm(at)linuxworld(dot)com(dot)au>, "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-23 06:46:50
Message-ID: GNELIHDDFBOCMGBFGEFOMENMCDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

> Quick hack while eating a sandwich.
>
> template1=# select * frum;
> ERROR: parser: parse error at or near "frum" at character 10
> ERROR QUERY: select * frum;
>
> Now, I did say quick hack. 'ERROR QUERY' isn't a new error level I just
> strcat() it to buf_msg in elog() if debug_print_error_query is
> true. Question: from Chris's request it doesn't sound like there is much
> use writing this to the client. Does everyone else feel the same way?
>
> If so, I'll patch it up and send off.

How about the ERROR occurs and is sent to client and logged. Then you do
another elog(LOG, querystring) sort of thing. That way you won't confuse
clients that are parsing the messages but those interested in the log text
can read it quite happily.

That'd be my preferred solution...

Thanks for working on this BTW gavin.

Chris


From: Markus Bertheau <twanger(at)bluetwanger(dot)de>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-23 07:54:57
Message-ID: 1030089298.6880.2.camel@saphir
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Fri, 2002-08-23 at 04:46, Bruce Momjian wrote:
>
> * Add GUC parameter to print queries that generate errors

Maybe don't make that an option, but rather do it always. I don't see
where that would hurt. And killing configuration options that are
unneeded is always a Good Thing.

--
Markus Bertheau.
Berlin, Berlin.
Germany.


From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Markus Bertheau" <twanger(at)bluetwanger(dot)de>, "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-23 09:13:08
Message-ID: GNELIHDDFBOCMGBFGEFOAENNCDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

So long as the change is only evident in the log, I agree.

Chris

> -----Original Message-----
> From: pgsql-hackers-owner(at)postgresql(dot)org
> [mailto:pgsql-hackers-owner(at)postgresql(dot)org]On Behalf Of Markus Bertheau
> Sent: Friday, 23 August 2002 3:55 PM
> To: Bruce Momjian
> Cc: Christopher Kings-Lynne; Hackers
> Subject: Re: [HACKERS] Proposed GUC Variable
>
>
> On Fri, 2002-08-23 at 04:46, Bruce Momjian wrote:
> >
> > * Add GUC parameter to print queries that generate errors
>
> Maybe don't make that an option, but rather do it always. I don't see
> where that would hurt. And killing configuration options that are
> unneeded is always a Good Thing.
>
> --
> Markus Bertheau.
> Berlin, Berlin.
> Germany.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Markus Bertheau <twanger(at)bluetwanger(dot)de>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-23 15:24:19
Message-ID: 200208231524.g7NFOJO07512@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


This is an intersting mix of features. First, use LOG so it goes only
to the log file by default _but_ can be turned on to be seen by the
client, and remove the GUC completely.

This does make 100% sense because an ERROR is going to go the client and
the server logs by default, and LOG is going to go to the server logs by
default _but_ can optionally be seen by the client by modifying
min_client_messagses.

---------------------------------------------------------------------------

Christopher Kings-Lynne wrote:
> So long as the change is only evident in the log, I agree.
>
> Chris
>
> > -----Original Message-----
> > From: pgsql-hackers-owner(at)postgresql(dot)org
> > [mailto:pgsql-hackers-owner(at)postgresql(dot)org]On Behalf Of Markus Bertheau
> > Sent: Friday, 23 August 2002 3:55 PM
> > To: Bruce Momjian
> > Cc: Christopher Kings-Lynne; Hackers
> > Subject: Re: [HACKERS] Proposed GUC Variable
> >
> >
> > On Fri, 2002-08-23 at 04:46, Bruce Momjian wrote:
> > >
> > > * Add GUC parameter to print queries that generate errors
> >
> > Maybe don't make that an option, but rather do it always. I don't see
> > where that would hurt. And killing configuration options that are
> > unneeded is always a Good Thing.
> >
> > --
> > Markus Bertheau.
> > Berlin, Berlin.
> > Germany.
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 6: Have you searched our list archives?
> >
> > http://archives.postgresql.org
> >
>
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Neil Conway <neilc(at)samurai(dot)com>
To: Markus Bertheau <twanger(at)bluetwanger(dot)de>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-23 17:56:44
Message-ID: 87fzx58nmr.fsf@mailbox.samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Markus Bertheau <twanger(at)bluetwanger(dot)de> writes:
> On Fri, 2002-08-23 at 04:46, Bruce Momjian wrote:
> >
> > * Add GUC parameter to print queries that generate errors
>
> Maybe don't make that an option, but rather do it always. I don't
> see where that would hurt.

It would hurt in situations in which an error is expected to occur
(e.g. INSERT into table, if constraint violation then do XYZ). It
would also make the logs a lot larger + less readable if long (say,
100 line) queries are being executed.

I don't think either situation is particularly common, but I do think
it's worth keeping a GUC variable for it. The GUC var should probably
default to being enabled though.

Cheers,

Neil

--
Neil Conway <neilc(at)samurai(dot)com> || PGP Key ID: DB3C29FC


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-27 20:54:24
Message-ID: 200208272054.g7RKsO814121@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


I had an idea on this. It seems pretty pointless to show a query error
without a query, but some queries are very large.

How about if we print only the first 80 characters of the query, with
newlines, tabs, and spaces reduced to a single space, and send that as
LOG to the server logs. That would give people enough context, and
prevent us from having another GUC variable.

---------------------------------------------------------------------------

Gavin Sherry wrote:
> Hi all,
>
> Quick hack while eating a sandwich.
>
> template1=# select * frum;
> ERROR: parser: parse error at or near "frum" at character 10
> ERROR QUERY: select * frum;
>
> Now, I did say quick hack. 'ERROR QUERY' isn't a new error level I just
> strcat() it to buf_msg in elog() if debug_print_error_query is
> true. Question: from Chris's request it doesn't sound like there is much
> use writing this to the client. Does everyone else feel the same way?
>
> If so, I'll patch it up and send off.
>
> Gavin
>
> On Thu, 22 Aug 2002, Bruce Momjian wrote:
>
> >
> > Someone asked for that recently, and the email is in my mailbox for
> > consideration. I think it is a great idea, and we have
> > debug_query_string that holds the current query. You could grab that
> > from elog.c. Added to TODO:
> >
> > * Add GUC parameter to print queries that generate errors
> >
> > ---------------------------------------------------------------------------
> >
> > Christopher Kings-Lynne wrote:
> > > Hi,
> > >
> > > My primary use of Postgres is as the backend database for a busy web site.
> > > We have a cron job that just emails us the tail of our database, php, apache
> > > logs every night. That way we can see some problems.
> > >
> > > These logs almost always contain some errors. For instance, this is what I
> > > see at the moment:
> > >
> > > 2002-08-22 19:21:57 ERROR: pg_atoi: error in "334 - 18k": can't parse " -
> > > 18k"
> > >
> > > Now there's plenty of places that accept numeric input in the site and
> > > obviously there's a bug in some script somewhere that's not filtering the
> > > input properly or something. However - the error message above is useless
> > > to me!!!
> > >
> > > So, what I'd like to propose is a new GUC variable called
> > > 'debug_print_query_on_error' or something. Instead of turning on
> > > debug_print_query and having my logs totally spammed up with sql, this GUC
> > > variable would only print the query if an actual ERROR occurred. This way I
> > > could nail the error very quickly by simply finding the query in my
> > > codebase.
> > >
> > > Is this possible? At the stage of processing where the elog(ERROR) occurs,
> > > do we still have access to the original query string?
> > >
> > > Comments?
> > >
> > > Chris
> > >
> > >
> > > ---------------------------(end of broadcast)---------------------------
> > > TIP 4: Don't 'kill -9' the postmaster
> > >
> >
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-27 20:57:24
Message-ID: 1030481845.410.23.camel@lerlaptop.iadfw.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Tue, 2002-08-27 at 15:54, Bruce Momjian wrote:
>
> I had an idea on this. It seems pretty pointless to show a query error
> without a query, but some queries are very large.
>
> How about if we print only the first 80 characters of the query, with
> newlines, tabs, and spaces reduced to a single space, and send that as
> LOG to the server logs. That would give people enough context, and
> prevent us from having another GUC variable.
Not necessarily giving enough context. I know I've had program
generated query's that were syntactically invalid WAY after the 80th
character.

If you print ANY of the query, you should print all of it. Look at the
code in elog.c that does the syslog splitting.

LER
>
> ---------------------------------------------------------------------------
>
> Gavin Sherry wrote:
> > Hi all,
> >
> > Quick hack while eating a sandwich.
> >
> > template1=# select * frum;
> > ERROR: parser: parse error at or near "frum" at character 10
> > ERROR QUERY: select * frum;
> >
> > Now, I did say quick hack. 'ERROR QUERY' isn't a new error level I just
> > strcat() it to buf_msg in elog() if debug_print_error_query is
> > true. Question: from Chris's request it doesn't sound like there is much
> > use writing this to the client. Does everyone else feel the same way?
> >
> > If so, I'll patch it up and send off.
> >
> > Gavin
> >
> > On Thu, 22 Aug 2002, Bruce Momjian wrote:
> >
> > >
> > > Someone asked for that recently, and the email is in my mailbox for
> > > consideration. I think it is a great idea, and we have
> > > debug_query_string that holds the current query. You could grab that
> > > from elog.c. Added to TODO:
> > >
> > > * Add GUC parameter to print queries that generate errors
> > >
> > > ---------------------------------------------------------------------------
> > >
> > > Christopher Kings-Lynne wrote:
> > > > Hi,
> > > >
> > > > My primary use of Postgres is as the backend database for a busy web site.
> > > > We have a cron job that just emails us the tail of our database, php, apache
> > > > logs every night. That way we can see some problems.
> > > >
> > > > These logs almost always contain some errors. For instance, this is what I
> > > > see at the moment:
> > > >
> > > > 2002-08-22 19:21:57 ERROR: pg_atoi: error in "334 - 18k": can't parse " -
> > > > 18k"
> > > >
> > > > Now there's plenty of places that accept numeric input in the site and
> > > > obviously there's a bug in some script somewhere that's not filtering the
> > > > input properly or something. However - the error message above is useless
> > > > to me!!!
> > > >
> > > > So, what I'd like to propose is a new GUC variable called
> > > > 'debug_print_query_on_error' or something. Instead of turning on
> > > > debug_print_query and having my logs totally spammed up with sql, this GUC
> > > > variable would only print the query if an actual ERROR occurred. This way I
> > > > could nail the error very quickly by simply finding the query in my
> > > > codebase.
> > > >
> > > > Is this possible? At the stage of processing where the elog(ERROR) occurs,
> > > > do we still have access to the original query string?
> > > >
> > > > Comments?
> > > >
> > > > Chris
> > > >
> > > >
> > > > ---------------------------(end of broadcast)---------------------------
> > > > TIP 4: Don't 'kill -9' the postmaster
> > > >
> > >
> > >
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> > (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
> >
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
> + If your life is a hard drive, | 13 Roberts Road
> + Christ can be your backup. | Newtown Square, Pennsylvania 19073
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


From: Rod Taylor <rbt(at)zort(dot)ca>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-27 21:03:17
Message-ID: 1030482198.51638.18.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Tue, 2002-08-27 at 16:54, Bruce Momjian wrote:
>
> I had an idea on this. It seems pretty pointless to show a query error
> without a query, but some queries are very large.
>
> How about if we print only the first 80 characters of the query, with
> newlines, tabs, and spaces reduced to a single space, and send that as
> LOG to the server logs. That would give people enough context, and
> prevent us from having another GUC variable.

I could go for the first 1000 characters, but 80 is almost useless for
most of our stuff. 80 wouldn't get through the select list a good chunk
of the time.

If an application in the product environment is throwing an error, we'd
want the full thing. Most of our internal systems are completely hands
off unless it's been scripted and tested elsewhere, so it's not like
user queries would be getting into it.

Perhaps a GUC for the length? But I'd still opt for storing the whole
thing. Yes, someone could fill up the disk but a rotating log would
help that.

> ---------------------------------------------------------------------------
>
> Gavin Sherry wrote:
> > Hi all,
> >
> > Quick hack while eating a sandwich.
> >
> > template1=# select * frum;
> > ERROR: parser: parse error at or near "frum" at character 10
> > ERROR QUERY: select * frum;
> >
> > Now, I did say quick hack. 'ERROR QUERY' isn't a new error level I just
> > strcat() it to buf_msg in elog() if debug_print_error_query is
> > true. Question: from Chris's request it doesn't sound like there is much
> > use writing this to the client. Does everyone else feel the same way?
> >
> > If so, I'll patch it up and send off.
> >
> > Gavin
> >
> > On Thu, 22 Aug 2002, Bruce Momjian wrote:
> >
> > >
> > > Someone asked for that recently, and the email is in my mailbox for
> > > consideration. I think it is a great idea, and we have
> > > debug_query_string that holds the current query. You could grab that
> > > from elog.c. Added to TODO:
> > >
> > > * Add GUC parameter to print queries that generate errors
> > >
> > > ---------------------------------------------------------------------------
> > >
> > > Christopher Kings-Lynne wrote:
> > > > Hi,
> > > >
> > > > My primary use of Postgres is as the backend database for a busy web site.
> > > > We have a cron job that just emails us the tail of our database, php, apache
> > > > logs every night. That way we can see some problems.
> > > >
> > > > These logs almost always contain some errors. For instance, this is what I
> > > > see at the moment:
> > > >
> > > > 2002-08-22 19:21:57 ERROR: pg_atoi: error in "334 - 18k": can't parse " -
> > > > 18k"
> > > >
> > > > Now there's plenty of places that accept numeric input in the site and
> > > > obviously there's a bug in some script somewhere that's not filtering the
> > > > input properly or something. However - the error message above is useless
> > > > to me!!!
> > > >
> > > > So, what I'd like to propose is a new GUC variable called
> > > > 'debug_print_query_on_error' or something. Instead of turning on
> > > > debug_print_query and having my logs totally spammed up with sql, this GUC
> > > > variable would only print the query if an actual ERROR occurred. This way I
> > > > could nail the error very quickly by simply finding the query in my
> > > > codebase.
> > > >
> > > > Is this possible? At the stage of processing where the elog(ERROR) occurs,
> > > > do we still have access to the original query string?
> > > >
> > > > Comments?
> > > >
> > > > Chris
> > > >
> > > >
> > > > ---------------------------(end of broadcast)---------------------------
> > > > TIP 4: Don't 'kill -9' the postmaster
> > > >
> > >
> > >
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> > (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
> >
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
> + If your life is a hard drive, | 13 Roberts Road
> + Christ can be your backup. | Newtown Square, Pennsylvania 19073
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Larry Rosenman <ler(at)lerctr(dot)org>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-27 21:05:33
Message-ID: 200208272105.g7RL5Y318829@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Larry Rosenman wrote:
> On Tue, 2002-08-27 at 15:54, Bruce Momjian wrote:
> >
> > I had an idea on this. It seems pretty pointless to show a query error
> > without a query, but some queries are very large.
> >
> > How about if we print only the first 80 characters of the query, with
> > newlines, tabs, and spaces reduced to a single space, and send that as
> > LOG to the server logs. That would give people enough context, and
> > prevent us from having another GUC variable.
> Not necessarily giving enough context. I know I've had program
> generated query's that were syntactically invalid WAY after the 80th
> character.
>
> If you print ANY of the query, you should print all of it. Look at the
> code in elog.c that does the syslog splitting.

But we should have some default to print some of the query, because
right now we print none of it. I am not saying it is perfect, but it is
better than what we have, and is a reasonable default.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Rod Taylor <rbt(at)zort(dot)ca>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-27 21:06:48
Message-ID: 200208272106.g7RL6m818936@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Rod Taylor wrote:
> On Tue, 2002-08-27 at 16:54, Bruce Momjian wrote:
> >
> > I had an idea on this. It seems pretty pointless to show a query error
> > without a query, but some queries are very large.
> >
> > How about if we print only the first 80 characters of the query, with
> > newlines, tabs, and spaces reduced to a single space, and send that as
> > LOG to the server logs. That would give people enough context, and
> > prevent us from having another GUC variable.
>
> I could go for the first 1000 characters, but 80 is almost useless for
> most of our stuff. 80 wouldn't get through the select list a good chunk
> of the time.
>
> If an application in the product environment is throwing an error, we'd
> want the full thing. Most of our internal systems are completely hands
> off unless it's been scripted and tested elsewhere, so it's not like
> user queries would be getting into it.
>
> Perhaps a GUC for the length? But I'd still opt for storing the whole
> thing. Yes, someone could fill up the disk but a rotating log would
> help that.

A length value would work, default to 80 and let someone turn it off
with zero and unlimited with 9999 or -1.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-27 21:08:16
Message-ID: 1030482496.410.33.camel@lerlaptop.iadfw.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Tue, 2002-08-27 at 16:05, Bruce Momjian wrote:
> Larry Rosenman wrote:
> > On Tue, 2002-08-27 at 15:54, Bruce Momjian wrote:
> > >
> > > I had an idea on this. It seems pretty pointless to show a query error
> > > without a query, but some queries are very large.
> > >
> > > How about if we print only the first 80 characters of the query, with
> > > newlines, tabs, and spaces reduced to a single space, and send that as
> > > LOG to the server logs. That would give people enough context, and
> > > prevent us from having another GUC variable.
> > Not necessarily giving enough context. I know I've had program
> > generated query's that were syntactically invalid WAY after the 80th
> > character.
> >
> > If you print ANY of the query, you should print all of it. Look at the
> > code in elog.c that does the syslog splitting.
>
> But we should have some default to print some of the query, because
> right now we print none of it. I am not saying it is perfect, but it is
> better than what we have, and is a reasonable default.
On an error, you may not be able to reproduce it. Why not print the
whole query to the log?

I don't see a reason for truncating it at 80 chars.

IMHO, of course.
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Larry Rosenman <ler(at)lerctr(dot)org>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-27 21:14:43
Message-ID: 200208272114.g7RLEhj19518@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Larry Rosenman wrote:
> > But we should have some default to print some of the query, because
> > right now we print none of it. I am not saying it is perfect, but it is
> > better than what we have, and is a reasonable default.
> On an error, you may not be able to reproduce it. Why not print the
> whole query to the log?
>
> I don't see a reason for truncating it at 80 chars.
>
> IMHO, of course.

Because every typo query, every syntax error of a user in psql would
appear in your logs. That seems excessive. Already the ERROR line
appears in the logs. Do we want to see their bad query too?

My concern is that long queries could easily bulk up the logs to the
point where the actual important log messages would be lost in the fog.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-27 21:17:07
Message-ID: 1030483028.410.38.camel@lerlaptop.iadfw.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Tue, 2002-08-27 at 16:14, Bruce Momjian wrote:
> Larry Rosenman wrote:
> > > But we should have some default to print some of the query, because
> > > right now we print none of it. I am not saying it is perfect, but it is
> > > better than what we have, and is a reasonable default.
> > On an error, you may not be able to reproduce it. Why not print the
> > whole query to the log?
> >
> > I don't see a reason for truncating it at 80 chars.
> >
> > IMHO, of course.
>
> Because every typo query, every syntax error of a user in psql would
> appear in your logs. That seems excessive. Already the ERROR line
> appears in the logs. Do we want to see their bad query too?
>
> My concern is that long queries could easily bulk up the logs to the
> point where the actual important log messages would be lost in the fog.
Hmm. I think the 80 should be a GUC variable (and also settable from
SQL SET as well), and the 80 should probably be higher.

And, maybe send the full query at a different Syslog(3) level.

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Larry Rosenman <ler(at)lerctr(dot)org>, Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-27 22:08:40
Message-ID: 14141.1030486120@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> But we should have some default to print some of the query,

Why? So far you've been told by two different people (make that three
now) that such a behavior is useless, and no one's weighed in in its
favor ...

regards, tom lane


From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Larry Rosenman <ler(at)lerctr(dot)org>, Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-27 22:30:04
Message-ID: 20020827223004.GA20278@rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Tue, Aug 27, 2002 at 06:08:40PM -0400, Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > But we should have some default to print some of the query,
>
> Why? So far you've been told by two different people (make that three
> now) that such a behavior is useless, and no one's weighed in in its
> favor ...

I agree that a 'trimmed' query is likely to be useless, but the idea of
printing the query on ERROR is a big win for me: right now I'm logging
_all_ queries on our development machine (and sometimes on our production
machine. when there's trouble) so my logs would get considerably smaller.

A settable trim length would probably be a good idea, I suppose, for
those slinging 'bytea' and toasted texts around.

Ross


From: Larry Rosenman <ler(at)lerctr(dot)org>
To: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-27 22:31:53
Message-ID: 1030487513.410.56.camel@lerlaptop.iadfw.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Tue, 2002-08-27 at 17:30, Ross J. Reedstrom wrote:
> On Tue, Aug 27, 2002 at 06:08:40PM -0400, Tom Lane wrote:
> > Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > > But we should have some default to print some of the query,
> >
> > Why? So far you've been told by two different people (make that three
> > now) that such a behavior is useless, and no one's weighed in in its
> > favor ...
>
> I agree that a 'trimmed' query is likely to be useless, but the idea of
> printing the query on ERROR is a big win for me: right now I'm logging
> _all_ queries on our development machine (and sometimes on our production
> machine. when there's trouble) so my logs would get considerably smaller.
I agree with printing the query on error... just not limiting it to 80
characters by default.
>
> A settable trim length would probably be a good idea, I suppose, for
> those slinging 'bytea' and toasted texts around.
Yes, but the default should be NO TRIM or in 1K-4K range. IMHO

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Larry Rosenman <ler(at)lerctr(dot)org>, Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-27 22:34:40
Message-ID: 14477.1030487680@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

"Ross J. Reedstrom" <reedstrm(at)rice(dot)edu> writes:
> I agree that a 'trimmed' query is likely to be useless, but the idea of
> printing the query on ERROR is a big win for me:

Certainly. I think though that an on-or-off GUC option is sufficient.
We don't need a length, and we definitely don't need code to strip out
whitespace as Bruce was suggesting ...

regards, tom lane


From: Rod Taylor <rbt(at)zort(dot)ca>
To: Larry Rosenman <ler(at)lerctr(dot)org>
Cc: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-27 22:39:48
Message-ID: 1030487989.66579.2.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

> > A settable trim length would probably be a good idea, I suppose, for
> > those slinging 'bytea' and toasted texts around.
> Yes, but the default should be NO TRIM or in 1K-4K range. IMHO

Ditto.


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>, Larry Rosenman <ler(at)lerctr(dot)org>, Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-27 23:17:36
Message-ID: 200208272317.g7RNHar24970@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


OK, just go with a boolean and admins can decide if they want it.

---------------------------------------------------------------------------

Tom Lane wrote:
> "Ross J. Reedstrom" <reedstrm(at)rice(dot)edu> writes:
> > I agree that a 'trimmed' query is likely to be useless, but the idea of
> > printing the query on ERROR is a big win for me:
>
> Certainly. I think though that an on-or-off GUC option is sufficient.
> We don't need a length, and we definitely don't need code to strip out
> whitespace as Bruce was suggesting ...
>
> regards, tom lane
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Karl DeBisschop <kdebisschop(at)alert(dot)infoplease(dot)com>
To: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-27 23:18:38
Message-ID: 1030490320.1090.3.camel@miles.debisschop.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Tue, 2002-08-27 at 17:17, Larry Rosenman wrote:
> On Tue, 2002-08-27 at 16:14, Bruce Momjian wrote:
> > Larry Rosenman wrote:
> > > > But we should have some default to print some of the query, because
> > > > right now we print none of it. I am not saying it is perfect, but it is
> > > > better than what we have, and is a reasonable default.
> > > On an error, you may not be able to reproduce it. Why not print the
> > > whole query to the log?
> > >
> > > I don't see a reason for truncating it at 80 chars.
> > >
> > > IMHO, of course.
> >
> > Because every typo query, every syntax error of a user in psql would
> > appear in your logs. That seems excessive. Already the ERROR line
> > appears in the logs. Do we want to see their bad query too?
> >
> > My concern is that long queries could easily bulk up the logs to the
> > point where the actual important log messages would be lost in the fog.
> Hmm. I think the 80 should be a GUC variable (and also settable from
> SQL SET as well), and the 80 should probably be higher.
>
> And, maybe send the full query at a different Syslog(3) level.

Not sure whether it can be done easily, but I think I'd prefer to log it
to a different file/facility. That lets me keep the full query for the
users, without swamping the sysadmin's logs. Just my $0.02.

--
Karl


From: ngpg(at)grymmjack(dot)com
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Proposed GUC Variable
Date: 2002-08-28 00:37:15
Message-ID: Xns9277D1C7D74FF9wn7t0983uom3iu23n@64.49.215.80
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane) wrote

> "Ross J. Reedstrom" <reedstrm(at)rice(dot)edu> writes:
>> I agree that a 'trimmed' query is likely to be useless, but the idea of
>> printing the query on ERROR is a big win for me:
>
> Certainly. I think though that an on-or-off GUC option is sufficient.
> We don't need a length, and we definitely don't need code to strip out
> whitespace as Bruce was suggesting ...

Just out of curiosity... how much harder would it be to have the GUC
variable represent the truncation length? so setting it to zero would be
equivalent to turning the feature off... I personally would have no use
for this feature, but I am just curious.


From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-28 01:59:40
Message-ID: Pine.LNX.4.21.0208281157330.14265-100000@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Tue, 27 Aug 2002, Tom Lane wrote:

> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > But we should have some default to print some of the query,
>
> Why? So far you've been told by two different people (make that three
> now) that such a behavior is useless, and no one's weighed in in its
> favor ...

I completely agree. Nothing wrong with adding another guc variable and
since it is a debug variable people expect lots of verbosity.

Once I check out some other suggestions by Christopher I'll send a patch
in -- its only a 10 liner.

Gavin


From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] Proposed GUC Variable
Date: 2002-08-28 06:26:47
Message-ID: Pine.LNX.4.21.0208281618300.23917-102000@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Wed, 28 Aug 2002, Gavin Sherry wrote:

> On Tue, 27 Aug 2002, Tom Lane wrote:
>
> > Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > > But we should have some default to print some of the query,
> >
> > Why? So far you've been told by two different people (make that three
> > now) that such a behavior is useless, and no one's weighed in in its
> > favor ...
>
> I completely agree. Nothing wrong with adding another guc variable and
> since it is a debug variable people expect lots of verbosity.

Attached is the patch. debug_print_error_query is set to false by default.

For want of a better phrase, I've prepended 'original query: ' to the
error message to highlight why it is in the log.

Gavin

Attachment Content-Type Size
guc.diff.gz application/x-gzip 1022 bytes
guc-doc.diff.gz application/x-gzip 316 bytes

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Gavin Sherry" <swm(at)linuxworld(dot)com(dot)au>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] Proposed GUC Variable
Date: 2002-08-28 07:32:49
Message-ID: GNELIHDDFBOCMGBFGEFOKEOOCDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

I tested this patch and I can confirm that it works very well on
FreeBSD/Alpha! This is such a cool feature - it's going to make my life so
much easier!

Do you think that 'original query: ..' looks a bit like bad english? Should
it be properly capitalised? ie. 'Original query: ...'? Just nitpicking...

Chris

> -----Original Message-----
> From: pgsql-patches-owner(at)postgresql(dot)org
> [mailto:pgsql-patches-owner(at)postgresql(dot)org]On Behalf Of Gavin Sherry
> Sent: Wednesday, 28 August 2002 2:27 PM
> To: Tom Lane
> Cc: Hackers; pgsql-patches(at)postgresql(dot)org
> Subject: Re: [PATCHES] [HACKERS] Proposed GUC Variable
>
>
> On Wed, 28 Aug 2002, Gavin Sherry wrote:
>
> > On Tue, 27 Aug 2002, Tom Lane wrote:
> >
> > > Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > > > But we should have some default to print some of the query,
> > >
> > > Why? So far you've been told by two different people (make that three
> > > now) that such a behavior is useless, and no one's weighed in in its
> > > favor ...
> >
> > I completely agree. Nothing wrong with adding another guc variable and
> > since it is a debug variable people expect lots of verbosity.
>
> Attached is the patch. debug_print_error_query is set to false by default.
>
> For want of a better phrase, I've prepended 'original query: ' to the
> error message to highlight why it is in the log.
>
> Gavin
>


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Hackers <pgsql-hackers(at)postgresql(dot)org>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] Proposed GUC Variable
Date: 2002-08-28 18:28:25
Message-ID: Pine.LNX.4.44.0208281836380.951-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Gavin Sherry writes:

> Attached is the patch. debug_print_error_query is set to false by default.
>
> For want of a better phrase, I've prepended 'original query: ' to the
> error message to highlight why it is in the log.

From your resident How-To-Name-Stuff Nitpicker:

1. The names of the debug_* GUC variables are leftovers from the pre-GUC
era and the names where left to include "debug" in them because at the
time it wasn't clear whether the implementation had more than server-code
debugging quality. New variables should be named log_*.

2. Unless you are only logging queries, the correct term is "statement" or
"commmand". Statements are defined in the SQL standard to end at the
semicolon, but if you're logging whatever the client passed in (which may
contain multiple statements) then "command" might be best. (consequently:
log_command_on_error or something like that)

3. Not sure what the "original" is for -- you're not transforming
anything.

--
Peter Eisentraut peter_e(at)gmx(dot)net


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Hackers <pgsql-hackers(at)postgresql(dot)org>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] Proposed GUC Variable
Date: 2002-08-28 18:29:26
Message-ID: Pine.LNX.4.44.0208281844140.951-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Christopher Kings-Lynne writes:

> Do you think that 'original query: ..' looks a bit like bad english? Should
> it be properly capitalised? ie. 'Original query: ...'? Just nitpicking...

I find it's generally better to not capitalize anything in program
messages, unless the sentence/paragraph nature is very evident. Otherwise
you get drawn into a big deal about which messages are sentences or
qualifying fragments, it creates inconsistencies if your messages get
embedded into other messages, and the next day you start thinking about
putting periods at the end, which is a really bad idea.

--
Peter Eisentraut peter_e(at)gmx(dot)net


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] Proposed GUC Variable
Date: 2002-08-28 19:05:05
Message-ID: 200208281905.g7SJ55k03836@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Peter Eisentraut wrote:
> Gavin Sherry writes:
>
> > Attached is the patch. debug_print_error_query is set to false by default.
> >
> > For want of a better phrase, I've prepended 'original query: ' to the
> > error message to highlight why it is in the log.
>
> >From your resident How-To-Name-Stuff Nitpicker:
>
> 1. The names of the debug_* GUC variables are leftovers from the pre-GUC
> era and the names where left to include "debug" in them because at the
> time it wasn't clear whether the implementation had more than server-code
> debugging quality. New variables should be named log_*.

Agreed. They are not really _debug_ for the server, but debug for user
apps; should be "log".

> 2. Unless you are only logging queries, the correct term is "statement" or
> "commmand". Statements are defined in the SQL standard to end at the
> semicolon, but if you're logging whatever the client passed in (which may
> contain multiple statements) then "command" might be best. (consequently:
> log_command_on_error or something like that)

Or log_statement_on_error. I think statement is better because we are
using that now for statement_timeout.

> 3. Not sure what the "original" is for -- you're not transforming
> anything.

Agreed. Just call it "Error query". Seems clear to me.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] Proposed GUC Variable
Date: 2002-08-28 19:07:57
Message-ID: 1030561678.469.39.camel@lerlaptop.iadfw.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Wed, 2002-08-28 at 14:05, Bruce Momjian wrote:
> Peter Eisentraut wrote:
> > Gavin Sherry writes:
> >
> > > Attached is the patch. debug_print_error_query is set to false by default.
> > >
> > > For want of a better phrase, I've prepended 'original query: ' to the
> > > error message to highlight why it is in the log.
> >
> > >From your resident How-To-Name-Stuff Nitpicker:
> >
> > 1. The names of the debug_* GUC variables are leftovers from the pre-GUC
> > era and the names where left to include "debug" in them because at the
> > time it wasn't clear whether the implementation had more than server-code
> > debugging quality. New variables should be named log_*.
>
> Agreed. They are not really _debug_ for the server, but debug for user
> apps; should be "log".
>
>
> > 2. Unless you are only logging queries, the correct term is "statement" or
> > "commmand". Statements are defined in the SQL standard to end at the
> > semicolon, but if you're logging whatever the client passed in (which may
> > contain multiple statements) then "command" might be best. (consequently:
> > log_command_on_error or something like that)
>
> Or log_statement_on_error. I think statement is better because we are
> using that now for statement_timeout.
>
> > 3. Not sure what the "original" is for -- you're not transforming
> > anything.
>
> Agreed. Just call it "Error query". Seems clear to me.
What about rule(s) transformation(s)? Will we see the real query or the
transformed query?

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Larry Rosenman <ler(at)lerctr(dot)org>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] Proposed GUC Variable
Date: 2002-08-28 19:11:09
Message-ID: 200208281911.g7SJB9M04913@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Larry Rosenman wrote:
> > > 3. Not sure what the "original" is for -- you're not transforming
> > > anything.
> >
> > Agreed. Just call it "Error query". Seems clear to me.
> What about rule(s) transformation(s)? Will we see the real query or the
> transformed query?

Well, looking at Gavin's patch, I see:

+ if(lev == ERROR && Debug_print_error_query)
+ elog(LOG,"original query: %s",debug_query_string);

That will be the query supplied by the user. To give them anything else
would be even more confusing --- "How did that query get executed. I
don't even see that query in my code". At least when they see that the
query and the error don't match, they can think, rules/triggers, etc.
We should mention the possible mismatch in the docs.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] Proposed GUC Variable
Date: 2002-08-29 16:09:58
Message-ID: 1030637398.3216.94.camel@camel
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

One of my users is generating a notice message --> NOTICE: Adding
missing FROM-clause entry for table "msg202" It might be helpful to
dump out the query on notice messages like this, and it looks like a
simple change as far as elog.c and guc.c are concerned, but would this
be overkill?

Robert Treat

On Wed, 2002-08-28 at 02:26, Gavin Sherry wrote:
> On Wed, 28 Aug 2002, Gavin Sherry wrote:
>
> > On Tue, 27 Aug 2002, Tom Lane wrote:
> >
> > > Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > > > But we should have some default to print some of the query,
> > >
> > > Why? So far you've been told by two different people (make that three
> > > now) that such a behavior is useless, and no one's weighed in in its
> > > favor ...
> >
> > I completely agree. Nothing wrong with adding another guc variable and
> > since it is a debug variable people expect lots of verbosity.
>
> Attached is the patch. debug_print_error_query is set to false by default.
>
> For want of a better phrase, I've prepended 'original query: ' to the
> error message to highlight why it is in the log.
>
> Gavin
>
> ----
>

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] Proposed GUC Variable
Date: 2002-08-29 16:14:24
Message-ID: 8775.1030637664@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Robert Treat <xzilla(at)users(dot)sourceforge(dot)net> writes:
> One of my users is generating a notice message --> NOTICE: Adding
> missing FROM-clause entry for table "msg202" It might be helpful to
> dump out the query on notice messages like this, and it looks like a
> simple change as far as elog.c and guc.c are concerned, but would this
> be overkill?

Hm. Maybe instead of a boolean, what we want is a message level
variable: log original query if it triggers a message >= severity X.

regards, tom lane


From: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>
To: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed GUC Variable
Date: 2002-08-29 17:17:35
Message-ID: 20020829171736.6A4521AFD@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On August 29, 2002 12:09 pm, Robert Treat wrote:
> One of my users is generating a notice message --> NOTICE: Adding
> missing FROM-clause entry for table "msg202" It might be helpful to
> dump out the query on notice messages like this, and it looks like a
> simple change as far as elog.c and guc.c are concerned, but would this
> be overkill?

Could be useful. In the meantime you still have an option. Turn on query
logging and then you can go back to your logs and find this notice and the
query that generated it. Note that this could create lots of logs so be
prepared. I think that Tom's suggestion is better in the long run but if you
need something now then that works.

--
D'Arcy J.M. Cain <darcy(at){druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.


From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] Proposed GUC Variable
Date: 2002-08-30 00:02:44
Message-ID: 1030665764.403.2.camel@lerlaptop.lerctr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Thu, 2002-08-29 at 19:04, Gavin Sherry wrote:
> On Thu, 29 Aug 2002, Tom Lane wrote:
>
> > Robert Treat <xzilla(at)users(dot)sourceforge(dot)net> writes:
> > > One of my users is generating a notice message --> NOTICE: Adding
> > > missing FROM-clause entry for table "msg202" It might be helpful to
> > > dump out the query on notice messages like this, and it looks like a
> > > simple change as far as elog.c and guc.c are concerned, but would this
> > > be overkill?
> >
> > Hm. Maybe instead of a boolean, what we want is a message level
> > variable: log original query if it triggers a message >= severity X.
>
> That's a pretty good idea. Now, what format will the argument take: text
> (NOTICE, ERROR, DEBUG, etc) or integer? The increasing severity is clear
> with numbers but the correlation to NOTICE, ERROR etc is undocumented
> IIRC. On the other hand, the textual form is clear but INFO < NOTICE <
> WARNING < ERROR < FATAL, etc, is note necessarily obvious. (Also, with the
> textual option the word will need to be converted to the corresponding
> number by the GUC code).
>
> Naturally, the problem with each option can be cleared up with
> documentation.
my gut feeling is use the words.

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] Proposed GUC Variable
Date: 2002-08-30 00:04:25
Message-ID: Pine.LNX.4.21.0208300956030.11955-100000@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Thu, 29 Aug 2002, Tom Lane wrote:

> Robert Treat <xzilla(at)users(dot)sourceforge(dot)net> writes:
> > One of my users is generating a notice message --> NOTICE: Adding
> > missing FROM-clause entry for table "msg202" It might be helpful to
> > dump out the query on notice messages like this, and it looks like a
> > simple change as far as elog.c and guc.c are concerned, but would this
> > be overkill?
>
> Hm. Maybe instead of a boolean, what we want is a message level
> variable: log original query if it triggers a message >= severity X.

That's a pretty good idea. Now, what format will the argument take: text
(NOTICE, ERROR, DEBUG, etc) or integer? The increasing severity is clear
with numbers but the correlation to NOTICE, ERROR etc is undocumented
IIRC. On the other hand, the textual form is clear but INFO < NOTICE <
WARNING < ERROR < FATAL, etc, is note necessarily obvious. (Also, with the
textual option the word will need to be converted to the corresponding
number by the GUC code).

Naturally, the problem with each option can be cleared up with
documentation.

Does anyone have a preference here?

Gavin


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] Proposed GUC Variable
Date: 2002-08-30 00:10:32
Message-ID: 200208300010.g7U0AWp10272@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Gavin Sherry wrote:
> On Thu, 29 Aug 2002, Tom Lane wrote:
>
> > Robert Treat <xzilla(at)users(dot)sourceforge(dot)net> writes:
> > > One of my users is generating a notice message --> NOTICE: Adding
> > > missing FROM-clause entry for table "msg202" It might be helpful to
> > > dump out the query on notice messages like this, and it looks like a
> > > simple change as far as elog.c and guc.c are concerned, but would this
> > > be overkill?
> >
> > Hm. Maybe instead of a boolean, what we want is a message level
> > variable: log original query if it triggers a message >= severity X.
>
> That's a pretty good idea. Now, what format will the argument take: text
> (NOTICE, ERROR, DEBUG, etc) or integer? The increasing severity is clear
> with numbers but the correlation to NOTICE, ERROR etc is undocumented
> IIRC. On the other hand, the textual form is clear but INFO < NOTICE <
> WARNING < ERROR < FATAL, etc, is note necessarily obvious. (Also, with the
> textual option the word will need to be converted to the corresponding
> number by the GUC code).
>
> Naturally, the problem with each option can be cleared up with
> documentation.

I think the arg has to be text. See server_min_messages GUC for an
example.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] Proposed GUC Variable
Date: 2002-08-30 00:42:28
Message-ID: 15459.1030668148@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:
> That's a pretty good idea. Now, what format will the argument take: text
> (NOTICE, ERROR, DEBUG, etc) or integer? The increasing severity is clear
> with numbers but the correlation to NOTICE, ERROR etc is undocumented
> IIRC. On the other hand, the textual form is clear but INFO < NOTICE <
> WARNING < ERROR < FATAL, etc, is note necessarily obvious.

The variable should take the same values as SERVER_MIN_MESSAGES and
impose the same priority order as it does. I would assume you could
share code, or at worst copy-and-paste a few dozen lines.

regards, tom lane


From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] Proposed GUC Variable
Date: 2002-08-31 16:28:21
Message-ID: Pine.LNX.4.21.0209010221010.18259-101000@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Thu, 29 Aug 2002, Tom Lane wrote:

> Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:
> > That's a pretty good idea. Now, what format will the argument take: text
> > (NOTICE, ERROR, DEBUG, etc) or integer? The increasing severity is clear
> > with numbers but the correlation to NOTICE, ERROR etc is undocumented
> > IIRC. On the other hand, the textual form is clear but INFO < NOTICE <
> > WARNING < ERROR < FATAL, etc, is note necessarily obvious.
>
> The variable should take the same values as SERVER_MIN_MESSAGES and
> impose the same priority order as it does. I would assume you could
> share code, or at worst copy-and-paste a few dozen lines.

A patch implementing this is attached. Instead of copy-and-pasting the
code, I abstracted out of the lookup and converted the existing functions
to use it.

I was careful in elog() to ignore elog(LOG) calls when
log_min_error_query >= LOG.

Gavin

Attachment Content-Type Size
guc2.diff.gz application/x-gzip 2.8 KB

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Proposed GUC Variable
Date: 2002-09-02 05:41:27
Message-ID: 200209020541.g825fRe13793@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


OK, attached patch applied. I made a few changes. I added a mention
they may want to enable LOG_PID because there is no guarantee that the
statement and error will appear next to each other in the log file. I
also renamed 'query' to 'statement' to be more precise.

Also, is there any way to disable this feature? I can't see how.

Also, you added this line:

+ extern bool Debug_print_error_query;

I assume it was a mistake.

---------------------------------------------------------------------------

Gavin Sherry wrote:
> On Thu, 29 Aug 2002, Tom Lane wrote:
>
> > Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:
> > > That's a pretty good idea. Now, what format will the argument take: text
> > > (NOTICE, ERROR, DEBUG, etc) or integer? The increasing severity is clear
> > > with numbers but the correlation to NOTICE, ERROR etc is undocumented
> > > IIRC. On the other hand, the textual form is clear but INFO < NOTICE <
> > > WARNING < ERROR < FATAL, etc, is note necessarily obvious.
> >
> > The variable should take the same values as SERVER_MIN_MESSAGES and
> > impose the same priority order as it does. I would assume you could
> > share code, or at worst copy-and-paste a few dozen lines.
>
> A patch implementing this is attached. Instead of copy-and-pasting the
> code, I abstracted out of the lookup and converted the existing functions
> to use it.
>
> I was careful in elog() to ignore elog(LOG) calls when
> log_min_error_query >= LOG.
>
> Gavin

Content-Description:

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 14.2 KB