-- -- We use this wrapper to catch errors and return errormsg only, -- because values of $::errorinfo variable contain procedure name which -- includes OID, so it's not stable -- CREATE FUNCTION pltcl_wrapper(statement text) RETURNS text AS $$ if [catch {spi_exec $1} msg] { return"ERROR: $msg"
} else { return"SUCCESS: $msg"
}
$$ LANGUAGE pltcl;
-- Test subtransaction successfully committed
CREATE FUNCTION subtransaction_ctx_success() RETURNS void AS $$
spi_exec "INSERT INTO subtransaction_tbl VALUES(1)"
subtransaction {
spi_exec "INSERT INTO subtransaction_tbl VALUES(2)"
}
$$ LANGUAGE pltcl;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.