On Jul 6, 2007, at 6:25 AM, Andreas Jung wrote:

>
> I have a self-referential mapper where a view is involved within a  
> primaryjoin of a relation. Traversing a tree represented through  
> the mapper generates a bunch of UPDATE operations on the view (no  
> idea why
> so far) although only SELECT operations are used during the query.
> However views in Postgres are read-only. The error message is
>
>
> (ProgrammingError)  kann eine Sicht nicht aktualisieren
> HINT:  Sie benötigen eine ON UPDATE DO INSTEAD Regel ohne Bedingung.
> 'UPDATE amhier_am_view SET bezeichnung=%(bezeichnung)s WHERE  
> amhier_am_view.hidx = %(amhier_am_view_hidx)s AND  
> amhier_am_view.versionsnr = %(amhier_am_view_versionsnr)s AND  
> amhier_am_view.idhierarchy = %(amhier_am_view_idhierarchy) 
> s' {'bezeichnung': 'Beiratsordnung einer GmbH (und GmbH & Co.  
> KG)', 'amhier_am_view_hidx': 'HI100010',  
> 'amhier_am_view_versionsnr': 0, 'amhier_am_view_idhierarchy': 166
>
> Basically it means "Can't update View. HINT: you need an ON UPDATE  
> DO INSTEAD rule without condition".
>
> Ok, I added a rule
>
> CREATE RULE XXX as ON UPDATE TO amhier_am_view DO INSTEAD NOTHING.
>
> This triggers this error message
>
>       Updated rowcount 0 does not match number of objects updated 201
>
> What to do?
>

put "viewonly=True" on the self-referential relation.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to