-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sql: mutations in statement sources don't work properly with limits #20732
Comments
The problem is that we don't flush the result when the plan is closed. The result is only flushed currently when the DML's datasource is exhausted. I think this is an okay change to make. I'll send it out for review. |
So I tried fixing this but it wasn't as straightforward as I was hoping. cc @knz do you expect an inner If so, and I think we should keep that expectation, we'll need to add a consume plan step when a plan is closed. I tried going down this path, but it's not straightforward - the right place for this seems like it should be in The resolution of this is a blocker for #20359, since common table expressions have the same problem - DML CTEs should be fully consumed in a plan. |
Terminology nit: SELECT is a DML statement too. DML is defined in contrast to DDL (schema definitions); it doesn't have anything to do with read-only vs read/write statements. |
will followup in #23156 |
As you can see, the inner
delete
never gets executed.Without a
limit
, or with anoffset
, this seems to work properly:Same problem exists with insert:
cc @knz
The text was updated successfully, but these errors were encountered: