* command_insert_txn_proc handles the insert command invocation through a PostgreSQL procedure. * this function behaves the same way as command_insert. */
| 215 | * this function behaves the same way as command_insert. |
| 216 | */ |
| 217 | Datum |
| 218 | command_insert_txn_proc(PG_FUNCTION_ARGS) |
| 219 | { |
| 220 | ReportFeatureUsage(FEATURE_COMMAND_INSERT); |
| 221 | |
| 222 | bool isTopLevel = true; |
| 223 | if (IsInTransactionBlock(isTopLevel)) |
| 224 | { |
| 225 | ereport(ERROR, (errcode(ERRCODE_DOCUMENTDB_OPERATIONNOTSUPPORTEDINTRANSACTION), |
| 226 | errmsg("the insert procedure cannot be used in transactions." |
| 227 | " Please use the insert function instead"))); |
| 228 | } |
| 229 | |
| 230 | /* Use function context as a stable memory context to store errors across transaction aborts */ |
| 231 | PG_RETURN_DATUM(CommandInsertCore(fcinfo, WriteMode_Txn_Proc, |
| 232 | fcinfo->flinfo->fn_mcxt)); |
| 233 | } |
| 234 | |
| 235 | |
| 236 | /* |
nothing calls this directly
no test coverage detected