Re: debug nonstandard use of \\ in a string literal

Lists: pgsql-general
From: "Ivan Zolotukhin" <ivan(dot)zolotukhin(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: debug nonstandard use of \\ in a string literal
Date: 2008-02-28 09:47:45
Message-ID: 751e56400802280147q22bd39aftd234176b34ebc783@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hello,

From time to time I face with these well-known warnings in the
PostgreSQL log, i.e.

Feb 28 04:21:10 db7 postgres[31142]: [2-1] WARNING: nonstandard use
of escape in a string literal at character 62
Feb 28 04:21:10 db7 postgres[31142]: [2-2] HINT: Use the escape
string syntax for escapes, e.g., E'\r\n'.

This is fine, everybody knows about that and our PL/PgSQL developers
try to make use of escape syntax. But sometimes errors occur anyway
(by developers mistakes or something). So the question is: how to
debug these annoying messages when pretty big application causes them?
Is it possible to have a look what exact queries produced them?

--
Regards,
Ivan


From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Ivan Zolotukhin *EXTERN*" <ivan(dot)zolotukhin(at)gmail(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: debug nonstandard use of \\ in a string literal
Date: 2008-02-28 11:28:04
Message-ID: D960CB61B694CF459DCFB4B0128514C2F34772@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Ivan Zolotukhin wrote:
> From time to time I face with these well-known warnings in the
> PostgreSQL log, i.e.
>
> Feb 28 04:21:10 db7 postgres[31142]: [2-1] WARNING: nonstandard use
> of escape in a string literal at character 62
> Feb 28 04:21:10 db7 postgres[31142]: [2-2] HINT: Use the escape
> string syntax for escapes, e.g., E'\r\n'.
>
> This is fine, everybody knows about that and our PL/PgSQL developers
> try to make use of escape syntax. But sometimes errors occur anyway
> (by developers mistakes or something). So the question is: how to
> debug these annoying messages when pretty big application causes them?
> Is it possible to have a look what exact queries produced them?

All I can think of is to set

log_statement=all
log_min_error_statement=WARNING
log_min_messages=WARNING

which will cause all statements and warnings to be logged.

This might of course generate a lot of output...

Yours,
Laurenz Albe


From: "Ivan Zolotukhin" <ivan(dot)zolotukhin(at)gmail(dot)com>
To: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: debug nonstandard use of \\ in a string literal
Date: 2008-03-04 12:52:33
Message-ID: 751e56400803040452r5f996abakf70fee781024c4c4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Thanks guys, this simple solution worked. Why didn't I guess before?..

On Thu, Feb 28, 2008 at 2:28 PM, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at> wrote:
>
> Ivan Zolotukhin wrote:
> > From time to time I face with these well-known warnings in the
> > PostgreSQL log, i.e.
> >
> > Feb 28 04:21:10 db7 postgres[31142]: [2-1] WARNING: nonstandard use
> > of escape in a string literal at character 62
> > Feb 28 04:21:10 db7 postgres[31142]: [2-2] HINT: Use the escape
> > string syntax for escapes, e.g., E'\r\n'.
> >
> > This is fine, everybody knows about that and our PL/PgSQL developers
> > try to make use of escape syntax. But sometimes errors occur anyway
> > (by developers mistakes or something). So the question is: how to
> > debug these annoying messages when pretty big application causes them?
> > Is it possible to have a look what exact queries produced them?
>
> All I can think of is to set
>
> log_statement=all
> log_min_error_statement=WARNING
> log_min_messages=WARNING
>
> which will cause all statements and warnings to be logged.
>
> This might of course generate a lot of output...
>
> Yours,
> Laurenz Albe
>