This note is in Hasura.Backends.Postgres.Translate.Returning.
It is referenced at:
Mutation output expression
An example output expression for INSERT mutation:
WITH “mra__" AS (
INSERT INTO ([..])
VALUES
([..])
ON CONFLICT ON CONSTRAINT "" DO NOTHING RETURNING *,
-- An extra column expression which performs the 'CHECK' validation
() AS "check__constraint"
),
"aca__" AS (
-- Only extract columns from mutated rows. Columns sorted by ordinal position so that
-- resulted rows can be casted to table type.
SELECT ([..])
FROM
"mra__"
)
<SELECT statement to generate mutation response using 'aca__' as FROM
and bool_and("check__constraint") from "mra__">