graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hasura.Backends.MSSQL.FromIr.Insert

Description

This module defines the translation functions for insert and upsert mutations.

Synopsis

Documentation

toMerge :: TableName -> [AnnotatedInsertRow 'MSSQL Expression] -> [ColumnInfo 'MSSQL] -> IfMatched Expression -> FromIr Merge Source #

Construct a MERGE statement from AnnotatedInsert information. A MERGE statement is responsible for actually inserting and/or updating the data in the table.

toInsertValuesIntoTempTable :: TempTableName -> AnnotatedInsert 'MSSQL Void Expression -> InsertValuesIntoTempTable Source #

As part of an INSERT/UPSERT process, insert VALUES into a temporary table. The content of the temporary table will later be inserted into the original table using a MERGE statement.

We insert the values into a temporary table first in order to replace the missing fields with DEFAULT in normalizeInsertRows, and we can't do that in a MERGE statement directly.