Обсуждение: BUG #2722: DBD::Pg v1.49 quoting generate warning

Поиск
Список
Период
Сортировка

BUG #2722: DBD::Pg v1.49 quoting generate warning

От
""
Дата:
The following bug has been logged online:

Bug reference:      2722
Logged by:
Email address:      postgres@bilteks.com
PostgreSQL version: 8.2beta1
Operating system:   FreeBSD 6.1
Description:        DBD::Pg v1.49 quoting generate warning
Details:

Current edition of DBD::Pg generate warning with default settings of
'escape_string_warning'=on and 'standard_conforming_strings'=off. Sample
below:

use DBI;
my
$DBH=DBI->connect('DBI:Pg:dbname=YourDB','login','password',{RaiseError=>'on
'});
my $text='text\\test';
print "text_before=[$text]\n";
$text=$DBH->quote($text);
print "text_after=[$text]\n";
$DBH->do("SELECT $text");

Result:
text_before=[text\test]
text_after=['text\\test']

DB Log:
2006-10-26 03:53:31 xxxx 77865 WARNING:  nonstandard use of \\ in a string
literal at character 8
2006-10-26 03:53:31 xxxx 77865 HINT:  Use the escape string syntax for
backslashes, e.g., E'\\'.
2006-10-26 03:53:31 xxxx 77865 STATEMENT:  SELECT 'text\\test'

Best regards,
 Alexander Kirpa

Re: BUG #2722: DBD::Pg v1.49 quoting generate warning

От
Bruce Momjian
Дата:
Read the documentation about the new warning, and use double
single-quotes in the string, or E'' strings.

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

postgres@bilteks.com wrote:
>
> The following bug has been logged online:
>
> Bug reference:      2722
> Logged by:
> Email address:      postgres@bilteks.com
> PostgreSQL version: 8.2beta1
> Operating system:   FreeBSD 6.1
> Description:        DBD::Pg v1.49 quoting generate warning
> Details:
>
> Current edition of DBD::Pg generate warning with default settings of
> 'escape_string_warning'=on and 'standard_conforming_strings'=off. Sample
> below:
>
> use DBI;
> my
> $DBH=DBI->connect('DBI:Pg:dbname=YourDB','login','password',{RaiseError=>'on
> '});
> my $text='text\\test';
> print "text_before=[$text]\n";
> $text=$DBH->quote($text);
> print "text_after=[$text]\n";
> $DBH->do("SELECT $text");
>
> Result:
> text_before=[text\test]
> text_after=['text\\test']
>
> DB Log:
> 2006-10-26 03:53:31 xxxx 77865 WARNING:  nonstandard use of \\ in a string
> literal at character 8
> 2006-10-26 03:53:31 xxxx 77865 HINT:  Use the escape string syntax for
> backslashes, e.g., E'\\'.
> 2006-10-26 03:53:31 xxxx 77865 STATEMENT:  SELECT 'text\\test'
>
> Best regards,
>  Alexander Kirpa
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq

--
  Bruce Momjian   bruce@momjian.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +