martin-g commented on issue #24998:
URL: https://github.com/apache/datafusion/issues/24998#issuecomment-6017092171

   Some investigations:
   
   I've implemented support for DELETE+LIMIT at 
https://github.com/apache/datafusion/compare/main...martin-g:datafusion:24998-add-support-for-delete-with-limit?expand=1
 but I noticed that sqlparser-rs does not support `OFFSET` for `DELETE`. So, I 
checked what the other major DBs do - only MySQL/MariaDB support `LIMIT` in a 
`DELETE` statement [[1](https://dev.mysql.com/doc/refman/9.7/en/delete.html)] 
[[2](https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/changing-deleting-data/delete)]!
   Postgres suggests to use a CTE 
[[3](https://www.postgresql.org/docs/current/sql-delete.html)].
   Some RDBMs can emulate it via using ROWNUM or ROWCOUNT.
   
   It seems sqlparser-rs supports `DELETE+LIMIT` for MySQL 
[[4](https://github.com/apache/datafusion-sqlparser-rs/issues/295)] but IMO it 
is a bug that it is enabled for the generic dialect too. I will file an issue.
   
   I will abandon my work on adding support for DELETE+LIMIT because without 
stable order this will be rather dangerous too.
   I will help https://github.com/apache/datafusion/pull/25005 to be merged 
soon!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to