A single query can write to multiple tables, using CTE's in PostgreSQL for example.
You could compose a SQL query that allows you to map multiple resultsets to 1 resultset, although that feels a bit awkward.
WITH a AS (
insert into a (k, v) values ('a', 1.0) returning *
), b AS (
insert into b (k, v) values ('b', 2.0) returning *
)
SELECT
row_to_json(a)
FROM
a
UNION ALL
SELECT
row_to_json(b)
FROM
b;
You could compose a SQL query that allows you to map multiple resultsets to 1 resultset, although that feels a bit awkward.
Returns: