silverstripe / silverstripe-postgresql

PostgreSQL module for Silverstripe CMS. Allows Silverstripe to connect to, and use PostgreSQL as a database.
Other
16 stars 33 forks source link

Support multi-table delete #98

Open ScopeyNZ opened 5 years ago

ScopeyNZ commented 5 years ago

Currently if you try to archive any object that is versioned you will get a fatal error using PostgreSQL - it doesn't support the multi table delete syntax built using DBQueryBuilder. This can be relatively easily addressed by overloading buildDeleteQuery in PostgreSQLQueryBuilder - the syntax can be changed to use sub-select conditions or CTEs.

Perhaps this issue would be better placed in framework as you might argue that the ORM should generate more SQL engine agnostic queries.

I was in two minds about whether this was type/bug or type/enhancement - It's pretty broken right now but there's a comment in the ORM code saying:

Note that some schemas don't support multiple table deletion

tractorcow commented 5 years ago

Multi table delete is technically allowed in SQLDeleteExpression, but it fails on lots of database connectors.