in reply to DBD:CSV and creating a database

I agree it should have bitched to high heaven when the SQL didn't parse correctly. In the past I have found that SQL::Statment is not very mature and you need to keep it up to date. Old versions are VERY buggy.

For what it's worth: I always build my SQL in a scalar before sending it to prepare(). Then I can print it out while debugging to make sure what you built is what you expected. Typically I code against Postgres and will simply copy and paste the "debug" statement into the DB's shell to make sure it does what I think, a luxury you don't have with DBD::CSV.

My code often looks like this when I am debugging it:

my $sql = "create table x as (y text)"; #DEBUG (it's this output that I copy/paste) print "$sql\n"; #or perhaps die "$sql\n"; $dbh->do($sql) or die $dbh->errstr() ...
If your only inserting data to a CSV file (as opposed to doing selects, etc) you might consider just using Text::CSV_XS which eliminates a lot of complexity/overhead.