[MDEV-32516] Returning Insert Resultset into Temporary Table Created: 2023-10-19  Updated: 2023-11-03

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Jacob W Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Wanted to mark this as an improvement but that type wasn't available.

For insert (and delete statements), the RETURNING clause can be used to return the records that were actually inserted into a table

Currently however the returned resultset can only be returned to the caller. It cannot be stored into a temporary table, used as the values for a CTE, be used as subquery for a select statement, etc.
i.e. we should be able to do this:

CREATE TEMPORARY TABLE test(ikey INT NOT NULL AUTO_INCREMENT, ival INT, PRIMARY KEY(ikey));
 
with inserted as(
INSERT INTO test(ival)
VALUES (10),(20),(30)
RETURNING ikey, ival
)

.
I believe both postgres and oracle support this syntax, and mssql has the OUTPUT clause.


Generated at Thu Feb 08 10:31:57 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.