dbTalk Databases Forums  

many warning in pg logs : nonstandard use of \\ in a string literalat character

comp.databases.postgresql comp.databases.postgresql


Discuss many warning in pg logs : nonstandard use of \\ in a string literalat character in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Patrox
 
Posts: n/a

Default many warning in pg logs : nonstandard use of \\ in a string literalat character - 09-14-2007 , 05:42 AM






hi !
I have many warnings like :

WARNING: nonstandard use of \\ in a string literal at character 69
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.

They are generated by an apache/php server using the db.

Any idea how to correct that ?
thx.
P.

Reply With Quote
  #2  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: many warning in pg logs : nonstandard use of \\ in a string literal at character - 09-14-2007 , 07:49 AM






Patrox <nospam (AT) nospammmmmmm (DOT) org> wrote:
Quote:
I have many warnings like :

WARNING: nonstandard use of \\ in a string literal at character 69
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.

They are generated by an apache/php server using the db.

Any idea how to correct that ?
Yes.

The first solution:

Edit postgresql.conf, set
standard_conforming_strings = on
and restart the server.

Then backslashes will be treated as normal characters, and if you
need them as escape character, you must preceed the string with an 'E',
as in E'string\nwith newline'.

This solution is good because this will be the default in some future
release.

The second solution:

Preceed all string literals that contain a backslash with an E as above
and replace single backslashes with double backslashes whenever they
should not be treated as escape character.

This may be a little more work.

The third solution:

Edit postgresql.conf, set
escape_string_warning = off
and restret the server.

This will get rid of the warnings; single backslashes will be treated as
escape characters.

I wouldn't recommend this because - as said - behaviour may change in
a future release.

Yours,
Laurenz Albe


Reply With Quote
  #3  
Old   
Patrox
 
Posts: n/a

Default Re: many warning in pg logs : nonstandard use of \\ in a string literalat character - 09-19-2007 , 05:10 AM



thx !!!

Laurenz Albe a écrit :
Quote:
Patrox <nospam (AT) nospammmmmmm (DOT) org> wrote:
I have many warnings like :

WARNING: nonstandard use of \\ in a string literal at character 69
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.

They are generated by an apache/php server using the db.

Any idea how to correct that ?

Yes.

The first solution:

Edit postgresql.conf, set
standard_conforming_strings = on
and restart the server.

Then backslashes will be treated as normal characters, and if you
need them as escape character, you must preceed the string with an 'E',
as in E'string\nwith newline'.

This solution is good because this will be the default in some future
release.

The second solution:

Preceed all string literals that contain a backslash with an E as above
and replace single backslashes with double backslashes whenever they
should not be treated as escape character.

This may be a little more work.

The third solution:

Edit postgresql.conf, set
escape_string_warning = off
and restret the server.

This will get rid of the warnings; single backslashes will be treated as
escape characters.

I wouldn't recommend this because - as said - behaviour may change in
a future release.

Yours,
Laurenz Albe

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.