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?

Andreas

--
ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany
Web: www.zopyx.com - Email: [EMAIL PROTECTED] - Phone +49 - 7071 - 793376
Registergericht: Amtsgericht Stuttgart, Handelsregister A 381535
Geschäftsführer/Gesellschafter: ZOPYX Limited, Birmingham, UK
------------------------------------------------------------------------
E-Publishing, Python, Zope & Plone development, Consulting

Attachment: pgpbDixzNVGcl.pgp
Description: PGP signature

Reply via email to