[Dbix-class] Error on updating a row in a rewritten view doesn't
work
Mario Minati
mario.minati at googlemail.com
Sat Dec 1 23:17:52 GMT 2007
I have got a problem updating a view ;-)
The class was working smoothly as long as I used the table ('company') itself
to crud the data.
Now I switched to a view with the following rules:
CREATE OR REPLACE RULE company__view__ins_instead AS
ON INSERT TO company__view DO INSTEAD
INSERT INTO company (name, subname, website, shortname, uuid, modified,
legalform_id, historic_id)
VALUES (new.name, new.subname, new.website, new.shortname, new.uuid,
new.modified, new.legalform_id, 0);
CREATE OR REPLACE RULE company__view__upd_instead AS
ON UPDATE TO company__view DO INSTEAD
UPDATE company SET name = new.name, subname = new.subname, website =
new.website, shortname = new.shortname, modified = new.modified, legalform_id
= new.legalform_id
WHERE company.id = new.id;
Reading and inserting is working fine as expected.
But updating creates an error:
DBIx::Class::Relationship::CascadeActions::update(): DBI Exception:
DBD::Pg::st execute failed: ERROR: bind message supplies 3 parameters, but
prepared statement "dbdpg_22" requires 2
[for Statement "UPDATE company__view SET modified = ?, shortname = ? WHERE (
id = ? )" with ParamValues: 1='2007-12-01 23:03:10+0000', 3='68', 2='diiasd']
at /home/mario/Desktop/dev/projects/glue/code/glue/trunk/script/../lib/glueDB/Contact/Company.pm
line 110
Running the given command from the pgadmin III Query Editor by hand works also
fine.
I would be very thankfull if anyone could give me a hint where to hint this
error down.
Thanks,
Mario
More information about the DBIx-Class
mailing list