当PostgreSQL需要insert 一条记录的时候,它会把记录头放入xmin,xmax等字段. xmin的值,就是当前的Transaction的TransactionId.这是为了满足MVCC的需要. 跟踪程序进行了解: /* * Allocate the next XID for a new transaction or subtransaction. * * The new XID is also stored into MyProc before returning. * * Note…
1 PL/pgSQL Under the Hood This part discusses some implementation details that are frequently important for PL/pgSQL users to know. 1.1 Variable Substitution SQL statements and expressions within a PL/pgSQL function can refer to variables and paramet…
Trigger Procedures PL/pgSQL can be used to define trigger procedures on data changes or database events. A trigger procedure is created with the CREATE FUNCTION command, declaring it as a function with no arguments and a return type of trigger (for d…
Control Structures of PL/SQL Control structures are probably the most useful (and important) part of PL/pgSQL.With PL/pgSQL's control structures, you can manipulate PostgreSQL data in a very flexible and powerful way. 1.Returning From a Function RETU…