[Dbix-class] Re: DBIx-Class-Schema-Loader bug: SQLite schema w/
"extra" newline bombs out the Loader
Dagfinn Ilmari Mannsåker
ilmari at ilmari.org
Mon Mar 24 22:42:17 GMT 2008
Jay Hannah <jay at jays.net> writes:
> Hola --
>
> Penfold and I think we found a bug. sqlite3 doesn't care about an extra
> newline when creating a table, but DBIx-Class-Schema-Loader pukes.
[snip description]
> sqlite3 is perfectly happy with that create table syntax, but DBIx-Class-Schema-Loader is not.
Actually, DBIx::Class::Schema::Loader _is_ happy with it, it's
DBD::SQLite's ->primary_key method which isn't.
> This is bad, since valid .schema's inside SQLite render
> DBIx-Class-Schema-Loader useless. And hopefully this is an easy fix for
> an eye more trained than mine?
>
>
> So where's the bug?
>
> Maybe it's around _sqlite_parse_table() in DBIx/Class/Schema/Loader/DBI/SQLite.pm line 65?:
>
> # Cut "CREATE TABLE ( )" blabla...
> $sql =~ /^[\w\s']+\((.*)\)$/si;
>
> I tried a couple patch attempts but didn't seem to figure it out...
That bit was my first suspect as well, but running Schema::Loader with
debug => 1 shows that it's not. The bit that fails is this:
MySchema::Foo->set_primary_key("create");
DBIx::Class::Schema::connect(): No such column create on table foo at (eval 142) line 5
The primary key is fetched using $dbh->primary_key(), which is returning
bogus data in this case.
> Want me to keep chasing a patch?
I don't particularly feel like going digging in the guts of DBD::SQLite;
feel free to do it for me :)
--
ilmari
"A disappointingly low fraction of the human race is,
at any given time, on fire." - Stig Sandbeck Mathisen
More information about the DBIx-Class
mailing list