reassign 321917 libdbd-pg-perl
found 321917 1.42-2
thanks

Hi Stephan, hi Raphael!

Stephan Springer [2005-08-08  9:27 +0200]:
> Package: postgresql-7.4
> Version: 1:7.4.8-14
> Severity: important
> 
> Consider the following Perl code:
> 
> use DBI;
> my $dbh = DBI->connect( 'DBI:Pg:host=localhost', undef,undef, { RaiseError => 
> 1 });
> my $sth = $dbh->prepare('select interval ?');
> $sth->execute( '1 hour' );
> 
>     This used to work with postgresql-7.4 1:7.4.8-9 and libdbd-pg-perl 1.42-1,
> but with libdbd-pg-perl 1.42-2 and postgresql-7.4 1:7.4.8-14 I get the
> following error message:
> 
> DBD::Pg::st execute failed: ERROR:  syntax error at or near "$1" at character 
> 17
> 
>     I have searched through the documentation, but haven't found any better
> means to convert a string to an interval.  Or am I missing something?  This
> completely breaks my Perl script, thus I'm setting severity to "important".

The PostgreSQL code hasn't changed between -9 and -14, the SQL
statement itself works:

# select interval '1 hour';
 interval
----------
 01:00:00
(1 Zeile)

and the variable substitution is something that the Perl DBI driver
performs, not PostgreSQL. Therefore I'm reassigning to libdbd-pg-perl.

For testing, I fixed the connection string and also made the
substitution a little more explicit:

---------- snip test.pl -----------
use DBI qw (:sql_types);
my $dbh = DBI->connect( 'DBI:Pg:dbname=template1', undef,undef, { RaiseError => 
1 });
my $sth = $dbh->prepare('select interval ?');
$sth->bind_param(1, '1 hour', SQL_VARCHAR);
$sth->execute();
---------- snip test.pl -----------

$ perl test.pl
DBD::Pg::st execute failed: ERROR:  Error »Syntax error« at »$1« at character 17
DBD::Pg::st execute failed: ERROR:  Error »Syntax error« at »$1« at character 17

(translated from German, might not be the exact English error
message). Same thing happens for SQL_TIME, I didn't find a DBI type
for a time interval. However, specifying it as string should work.

Thanks,

Martin

-- 
Martin Pitt        http://www.piware.de
Ubuntu Developer   http://www.ubuntu.com
Debian Developer   http://www.debian.org

Attachment: signature.asc
Description: Digital signature

Reply via email to