Skip Menu |

This queue is for tickets about the Email-Store CPAN distribution.

Report information
The Basics
Id: 6900
Status: resolved
Priority: 0/
Queue: Email-Store

People
Owner: Nobody in particular
Requestors: ittigson [...] pobox.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.11
Fixed in: (no value)



Subject: Error setting up the Email::Store::List "database"
I get this error when trying to run Email::Store->setup. The SQLite .db file gets created and is empty. I tried using Postgres instead of SQLite, and got essentially the same error. DBD::SQLite::db do failed: near "NOT": syntax error [for Statement "CREATE TABLE IF NOT EXISTS list ( id integer NOT NULL auto_increment primary key, name varchar(255), posting_address varchar(255) )"] at /usr/share/perl5/Class/DBI/DATA/Schema.pm line 123. It's on a Debian/testing box, running Email::Store 0.11 (I also got the error in version 0.08).
From: ittigson [...] pobox.com
[guest - Thu Jul 8 17:42:43 2004]: Show quoted text
> I get this error when trying to run Email::Store->setup. The SQLite > .db file gets created and is empty. I tried using Postgres instead > of SQLite, and got essentially the same error. > > DBD::SQLite::db do failed: near "NOT": syntax error [for Statement > "CREATE TABLE IF NOT EXISTS list ( > id integer NOT NULL auto_increment primary key, > name varchar(255), > posting_address varchar(255) > )"] at /usr/share/perl5/Class/DBI/DATA/Schema.pm line 123. > > It's on a Debian/testing box, running Email::Store 0.11 (I also got > the error in version 0.08).
It appears this is caused by the linefeed between the __DATA__ directive and the first SQL command. I get the same error in Email::Store::Mail.
From: ittigson [...] pobox.com
[guest - Thu Jul 8 17:56:59 2004]: Show quoted text
> [guest - Thu Jul 8 17:42:43 2004]: >
> > I get this error when trying to run Email::Store->setup. The SQLite > > .db file gets created and is empty. I tried using Postgres
> instead
> > of SQLite, and got essentially the same error. > > > > DBD::SQLite::db do failed: near "NOT": syntax error [for Statement > > "CREATE TABLE IF NOT EXISTS list ( > > id integer NOT NULL auto_increment primary key, > > name varchar(255), > > posting_address varchar(255) > > )"] at /usr/share/perl5/Class/DBI/DATA/Schema.pm line 123. > > > > It's on a Debian/testing box, running Email::Store 0.11 (I also got > > the error in version 0.08).
> > > It appears this is caused by the linefeed between the __DATA__ > directive > and the first SQL command. I get the same error in > Email::Store::Mail.
My bad ... ignore that last comment ... it's just plain wrong. Sorry.
From: ittigson [...] pobox.com
[guest - Thu Jul 8 17:42:43 2004]: Show quoted text
> I get this error when trying to run Email::Store->setup. The SQLite > .db file gets created and is empty. I tried using Postgres instead > of SQLite, and got essentially the same error. > > DBD::SQLite::db do failed: near "NOT": syntax error [for Statement > "CREATE TABLE IF NOT EXISTS list ( > id integer NOT NULL auto_increment primary key, > name varchar(255), > posting_address varchar(255) > )"] at /usr/share/perl5/Class/DBI/DATA/Schema.pm line 123. > > It's on a Debian/testing box, running Email::Store 0.11 (I also got > the error in version 0.08).
The problem is that the final semi-colon at the end of the statements in the data section of any Email::Store plugin isn't being included in the output of the get_statements call inside Class::DBI::DATA::Schema->run_data_sql which, at least in the case of Postgres and SQLite, breaks the SQL::Translator parser. Inside get_statements there's a split on semi-colon, which is why that isn't included in the statement passed to SQL::Translator. I don't know whether the bug then lies in SQL::Translator for not working without a semi-colon or with Class::DBI::DATA::Schema for not including the semi-colon in the statement.
From: ittigson [...] pobox.com
[guest - Fri Jul 9 14:09:11 2004]: Show quoted text
> [guest - Thu Jul 8 17:42:43 2004]: >
> > I get this error when trying to run Email::Store->setup. The SQLite > > .db file gets created and is empty. I tried using Postgres
> instead
> > of SQLite, and got essentially the same error. > > > > DBD::SQLite::db do failed: near "NOT": syntax error [for Statement > > "CREATE TABLE IF NOT EXISTS list ( > > id integer NOT NULL auto_increment primary key, > > name varchar(255), > > posting_address varchar(255) > > )"] at /usr/share/perl5/Class/DBI/DATA/Schema.pm line 123. > > > > It's on a Debian/testing box, running Email::Store 0.11 (I also got > > the error in version 0.08).
> > The problem is that the final semi-colon at the end of the statements > in > the data section of any Email::Store plugin isn't being included in > the > output of the get_statements call inside > Class::DBI::DATA::Schema->run_data_sql which, at least in the case of > Postgres and SQLite, breaks the SQL::Translator parser. > > Inside get_statements there's a split on semi-colon, which is why that > isn't included in the statement passed to SQL::Translator. I don't > know > whether the bug then lies in SQL::Translator for not working without a > semi-colon or with Class::DBI::DATA::Schema for not including the > semi-colon in the statement.
Alright ... once again, I'm not correct tracking down this bug. The semi-colon does end up in the right place. In fact, it's not a call to SQL::Translator that breaks anything. The SQL statement is plain old not getting translated, apparently because the statement is cached before it has a chance to be translated (line 85 in Class::DBI::DATA::Schema), but I'm having an awful time trying to figure out where the statement is being cached.
From: ittigson [...] pobox.com
[guest - Thu Jul 8 17:42:43 2004]: Show quoted text
> I get this error when trying to run Email::Store->setup. The SQLite > .db file gets created and is empty. I tried using Postgres instead > of SQLite, and got essentially the same error. > > DBD::SQLite::db do failed: near "NOT": syntax error [for Statement > "CREATE TABLE IF NOT EXISTS list ( > id integer NOT NULL auto_increment primary key, > name varchar(255), > posting_address varchar(255) > )"] at /usr/share/perl5/Class/DBI/DATA/Schema.pm line 123. > > It's on a Debian/testing box, running Email::Store 0.11 (I also got > the error in version 0.08).
Close it up. The problem was the my /tmp/emailstore_sqlcache directory hadn't been cleaned up. Sorry for all the traffic and incorrect information.
Bug found to be in user.