logo       

Re: Error on updating a row in a rewritten view doesn't work: msg#00039

Subject: Re: Error on updating a row in a rewritten view doesn't work
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/



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
audio.irate.dev...    yellowdog.gener...    ietf.ips/2002-0...    xfree86.fonts/2...    busybox/2003-07...    emacs.jdee/2004...    linux.mandrake....    hardware.microc...    user-groups.lin...    science.analysi...    version-control...    db.filemaker.de...    cluster.openmos...    mail.eyebrowse....    text.xml.xerces...    kde.devel.kwrit...    finance.moneyda...    gcc.regression/...    network.routing...    os.freebsd.deve...    recreation.radi...    qnx.openqnx.dev...    python.xml/2002...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe