[Dbix-class] creating a row that's empty but for an auto-incremented key?

George Hartzell hartzell at alerce.com
Sat Jul 8 01:43:38 CEST 2006


I'd like to create a row in a table that's empty except for it's
primary key column (e.g. 'id'), which should be automatically
generated by PK::Auto.  I go on to possibly insert things into it
and/or have rows in other tables which have it's id as a foreign key.

I'm using Postgresql on FreeBSD 6.1 and DBIx::Class 0.06003.

The closest thing to the Class::DBI idiom that I know seems to be
this:

  $foo = $schema->resultset('Foo')->create({});

but that says (retyped by hand and wrapped):

  DBIx::Class::ResultSet::Create(): Error executing 'INSERT INTO 
    foo () VALUES ()' (): Error syntax error at or near ")" at
    character 21

and flipping the sql debugging environment variable shows that it is
try insert "nothing", e.g.

  INSERT INTO foo () VALUES () ()

What's the DBIx::Class idiom/recipe?

Thanks,

g.



More information about the Dbix-class mailing list