[Dbix-class] Weird INSERT RETURNING error after updating to
DBIx::Class .08121
Steve Kleiman
steve at prodhub.com
Tue Jun 22 14:40:46 GMT 2010
Searched the archives on this and didn't see anyone else raise the issue....
Just upgraded to DBIx::Class .08121 of April 11, 2010.
I see in the Changelog:
> DBIx::Class
> 0.08121 2010-04-11 18:43:00 (UTC)
> - Add core support for INSERT RETURNING (for storages that supports this syntax, currently PostgreSQL and Firebird)
I'm using Postgres. Before the update, a simple create query was dispatched as:
> INSERT INTO "project"."vendor_view" ( "name", "project", "classification_xref") VALUES ( 1277144170, 3819016, 10 );
That worked great and returned the newly created id. Cool.
After upgrading to DBIx::Class .08121, the SQL generated is now:
> INSERT INTO "project"."vendor_view" ( "name", "project", "classification_xref") VALUES ( 1277144170, 3819016, 10 ) RETURNING id
And that throws the error:
> ERROR: cannot perform INSERT RETURNING on relation "vendor_view"
> HINT: You need an unconditional ON INSERT DO INSTEAD rule with a RETURNING clause.
I've tried everything I can think of to alter my database views to cater to this new change, but I haven't gotten anywhere.
I see in DBIX::Class::Storage::DBI::Pg the comment:
> # only used when INSERT ... RETURNING is disabled
> sub last_insert_id {
> ...
> }
Seems to me I want to disable the RETURNING functionality to make the behavior like it was, but I can't figure out how to do that.
Anyone else experienced this?
Thanks in advance.
-steve kleiman
More information about the DBIx-Class
mailing list