#261 cannot delete objects when many-to-many still none

open
Oleg Broytman
Postgres (36)
5
2010-06-18
2010-05-31
Philipp
No

I have objects with many-to-many relationships. However it may happen that none of these relationships was set, when I want to delete one of the objects. Python returns the following error:
psycopg2.ProgrammingError: relation "none" does not exist

I fixed it by inserting:
if join.intermediateTable:
In function destroySelf() before starting the SQL query to delete the entry in the intermediate table. Which apparently is not created if no many-to-many relationship have been set. Another approach would be to make sure that an intermediate table exists even when there are still no entries defined. This would probably be more secure if other functions also assume that this table already exists.

SQLObject version 12.3, Python 2.6, Postgres 8.4

Discussion

  • Oleg Broytman
    Oleg Broytman
    2010-06-18

    Can you write a short script to demonstrate the problem? I will turn it into a test case. Thanks in advance.

     
  • Oleg Broytman
    Oleg Broytman
    2010-06-18

    • assigned_to: nobody --> phd