[Dbix-class] Error on updating a row in a rewritten view doesn't
work
Matt S Trout
dbix-class at trout.me.uk
Sun Dec 16 01:56:12 GMT 2007
On Sun, Dec 02, 2007 at 12:17:52AM +0100, Mario Minati wrote:
> 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
That's usually prepared statements getting confused because you've changed the
schema and DBIC didn't know to reconnect.
If a server restart didn't fix it, next thing would be to try a DBIC_TRACE and
see where dbdpg_22 is originally created.
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
More information about the DBIx-Class
mailing list