-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Support multiple rows for DML RETURNING #6815
Comments
Should we have some option (config / DPB / SET) to maintain DSQL compatibility? |
On 5/17/21 4:39 PM, Adriano dos Santos Fernandes wrote:
Should we have some option (config / DPB / SET) to maintain DSQL
compatibility?
If there will be such need - certainly, if not - what sense in it?
|
I don't think it should be configurable. |
I don't remember exact reason for why it was done as singleton. Was it due to extra remote protocol roundtrip? |
Problem with partially fetched result set. |
Exactly. And RETURNING was primarily intended for a INSERT ... VALUES statement which is singular anyway. |
To address the roundtrip thing, we could consider introducing a new execute method which will stream all rows without requiring fetches, but that could be overkill. |
I specifically address that in my proposal:
|
I want more opinions on this. I understand the problem you want to avoid, specially in remote protocol which things can be buffered. But it will make DSQL and PSQL with very different behavior. Assuming we have a procedure P2 doing But with an EXECUTE BLOCK doing |
FOR UPDATE\DELETE ... RETURNING could (should?) also buffer all returned rows before getting them out |
I think even in PSQL, a |
I have split the PSQL |
Failing test bugs.core_0501, noted by Vlad.
::: test details ::: Test verifies only basic issues related mostly to syntax and ability to get multiple rows. Interruption of fetching process by client (and check number of affected rows) is NOT verified: |
@pavel-zotov to make things clear, the atomic changes, then returning, is already implemented for the DSQL case. And for PSQL without FOR (tracked in #6925), things should work as before. |
Currently, DML RETURNING only supports singleton inserts/updates/deletes. This restriction should be relaxed so that the following statements can return multiple rows:
INSERT ... SELECT ...
UPDATE
DELETE
MERGE
UPDATE OR INSERT
The following can remain as-is (though maybe a unified implementation makes more sense?):
INSERT ... DEFAULT VALUES
/INSERT ... VALUES (...)
(at least, until Firebird supports table value constructors)UPDATE
(withWHERE CURRENT OF ...
)DELETE
(withWHERE CURRENT OF ...
)I suggest the implementation describes itself as
isc_info_sql_stmt_select
; this should make it compatible with most libraries and tools that rely on the statement type to decide on how to execute. The alternative is to introduce a new type (or types), for exampleisc_info_sql_stmt_dml_returning
or something, but I think that makes things harder because tools and libraries would need to be updated to support this.When such a statement is executed, Firebird should execute the statement to completion and collect all requested data in a type of temporary table, once execution is complete, fetches are done against this temporary table. In other words, even if no rows are fetched, all DML changes have been performed.
In PSQL, these statements should use the current singleton behaviour.
Non-singleton
FOR ... RETURNING
in PSQL is tracked in #6925.The text was updated successfully, but these errors were encountered: