Bug#354421: libdbd-sqlite3-perl: fails to add columns using SQL commands

Christoph Biedl cbiedl at gmx.de
Sun Feb 26 05:01:33 UTC 2006


Package: libdbd-sqlite3-perl
Version: 1.08-1
Severity: normal

To my big surprise I cannot issue an "ALTER TABLE table ADD" command
using the Perl library.

The sqlite3 command line tool works fine:

$ sqlite3 test2.db
SQLite version 3.2.1
Enter ".help" for instructions
sqlite> CREATE TABLE data (foo INTEGER);
sqlite> ALTER TABLE data ADD bar INTEGER;
sqlite> .schema data
CREATE TABLE data (foo INTEGER, bar INTEGER);

Now the same in a perl script using libdbd-sqlite3-perl:
---------------------------------------------------------------
#!/usr/bin/perl -w

use DBI;

use strict;

sub docmd ($);

my $dbh = DBI -> connect('dbi:SQLite:dbname=test.db', '', '') or die;

docmd ('CREATE TABLE data (foo INTEGER)');
docmd ("ALTER TABLE data ADD bar INTEGER");

sub docmd ($) {
    my $q = $_[0];
    my $sth;
    ($sth  = $dbh -> prepare ($q)) ||
        die "cannot prepare $q: $DBI::errstr";
    ($sth -> execute ()) ||
        die "cannot execute $q: $DBI::errstr";
}
---------------------------------------------------------------
This results in:

$ perl -w /tmp/test_sqlite 
DBD::SQLite::db prepare failed: near "ADD": syntax error(1) at dbdimp.c
line 268 at /tmp/test_sqlite line 17.
cannot prepare ALTER TABLE data ADD bar INTEGER: near "ADD": syntax
error(1) at dbdimp.c line 268 at /tmp/test_sqlite line 17.

Please assist. I need the ability to add columns add a later time.

-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.6.15
Locale: LANG=de_DE.UTF-8 at euro, LC_CTYPE=de_DE.UTF-8 at euro (charmap=UTF-8)

Versions of packages libdbd-sqlite3-perl depends on:
ii  libc6                      2.3.2.ds1-22  GNU C Library: Shared libraries an
ii  libdbi-perl                1.46-6        Perl5 database interface by Tim Bu
ii  perl                       5.8.4-8sarge3 Larry Wall's Practical Extraction 
ii  perl-base [perlapi-5.8.4]  5.8.4-8sarge3 The Pathologically Eclectic Rubbis

-- no debconf information




More information about the pkg-perl-maintainers mailing list