{"Entry":{"collection":"sql","key":"start-transaction","name":"START TRANSACTION","aliases":["start-transaction"],"metadata":{"aliases":["start-transaction"],"changed_in":["7.4","8.0","9.0","9.1"],"changes":[{"from":"7.2","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"added","synopsis":null,"to":"7.3"},{"from":"7.3","purpose_changed":false,"renamed":null,"sections":{"added":["parameters","see_also"],"changed":["description","compatibility"],"removed":["notes"]},"status":"changed","synopsis":{"added":["START TRANSACTION [ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ]"],"removed":[]},"to":"7.4"},{"from":"7.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description","parameters","compatibility","see_also"],"removed":[]},"status":"changed","synopsis":{"added":["START TRANSACTION [ transaction_mode [, ...] ]","where transaction_mode is one of:","ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED }"],"removed":["START TRANSACTION [ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ]"]},"to":"8.0"},{"from":"8.2","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["compatibility"],"removed":[]},"status":"changed","synopsis":null,"to":"8.3"},{"from":"8.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":{"added":[],"removed":["where transaction_mode is one of:"]},"to":"9.0"},{"from":"9.0","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description","compatibility"],"removed":[]},"status":"changed","synopsis":{"added":["[ NOT ] DEFERRABLE"],"removed":[]},"to":"9.1"},{"from":"9.6","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["compatibility"],"removed":[]},"status":"changed","synopsis":null,"to":"10"}],"content_hash":"3d5a0beb8354190b7e5464465236e99ab5a53c55a41a471ddc13e7e87d688abd","editorial":{},"first_version":"7.3","group":"transaction","imported_at":"2026-09-30T17:43:39.409943+08:00","last_version":"20","name":"START TRANSACTION","object":"TRANSACTION","position":13014,"present_in":["7.3","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"purpose":"start a transaction block","purpose_zh":"","related":["begin","commit","rollback","savepoint","set-transaction"],"slug":"start-transaction","source_rev":"a709ab85","synopsis":"START TRANSACTION [ transaction_mode [, ...] ]\n\nwhere transaction_mode is one of:\n\nISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED }\nREAD WRITE | READ ONLY\n[ NOT ] DEFERRABLE","verb":"START"}},"Definition":{"Collection":"sql","Key":"start-transaction","SourceDatabase":"center","Version":"18","SourceTable":"sqlcmd","SourceKey":"start-transaction","SourceRevision":"a709ab85","Facts":{"anchor":"SQL-START-TRANSACTION","file":"sql-start-transaction.html","lang":"en","name":"START TRANSACTION","purpose":"start a transaction block","purpose_zh":"","related":["begin","commit","rollback","savepoint","set-transaction"],"sections":[{"html":"\u003cp\u003eThis command begins a new transaction block. If the isolation level, read/write mode, or deferrable mode is specified, the new transaction has those characteristics, as if \u003ca href=\"/docs/18/sql-set-transaction.html\" title=\"SET TRANSACTION\"\u003e\u003ccode class=\"command\"\u003eSET TRANSACTION\u003c/code\u003e\u003c/a\u003e was executed. This is the same as the \u003ca href=\"/docs/18/sql-begin.html\" title=\"BEGIN\"\u003e\u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e\u003c/a\u003e command.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cp\u003eRefer to \u003ca href=\"/docs/18/sql-set-transaction.html\" title=\"SET TRANSACTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eSET TRANSACTION\u003c/span\u003e\u003c/a\u003e for information on the meaning of the parameters to this statement.\u003c/p\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003eIn the standard, it is not necessary to issue \u003ccode class=\"command\"\u003eSTART TRANSACTION\u003c/code\u003e to start a transaction block: any SQL command implicitly begins a block. \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e's behavior can be seen as implicitly issuing a \u003ccode class=\"command\"\u003eCOMMIT\u003c/code\u003e after each command that does not follow \u003ccode class=\"command\"\u003eSTART TRANSACTION\u003c/code\u003e (or \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e), and it is therefore often called \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eautocommit\u003c/span\u003e”\u003c/span\u003e. Other relational database systems might offer an autocommit feature as a convenience.\u003c/p\u003e\u003cp\u003eThe \u003ccode class=\"literal\"\u003eDEFERRABLE\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003etransaction_mode\u003c/code\u003e\u003c/em\u003e is a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e language extension.\u003c/p\u003e\u003cp\u003eThe SQL standard requires commas between successive \u003cem class=\"replaceable\"\u003e\u003ccode\u003etransaction_modes\u003c/code\u003e\u003c/em\u003e, but for historical reasons \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e allows the commas to be omitted.\u003c/p\u003e\u003cp\u003eSee also the compatibility section of \u003ca href=\"/docs/18/sql-set-transaction.html\" title=\"SET TRANSACTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eSET TRANSACTION\u003c/span\u003e\u003c/a\u003e.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/begin/?v=18\" title=\"BEGIN\"\u003e\u003cspan class=\"refentrytitle\"\u003eBEGIN\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/commit/?v=18\" title=\"COMMIT\"\u003e\u003cspan class=\"refentrytitle\"\u003eCOMMIT\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/rollback/?v=18\" title=\"ROLLBACK\"\u003e\u003cspan class=\"refentrytitle\"\u003eROLLBACK\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/savepoint/?v=18\" title=\"SAVEPOINT\"\u003e\u003cspan class=\"refentrytitle\"\u003eSAVEPOINT\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/set-transaction/?v=18\" title=\"SET TRANSACTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eSET TRANSACTION\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","slug":"18","synopsis_html":"START TRANSACTION [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003etransaction_mode\u003c/code\u003e\u003c/em\u003e [, ...] ]\n\n\u003cspan class=\"phrase\"\u003ewhere \u003cem class=\"replaceable\"\u003e\u003ccode\u003etransaction_mode\u003c/code\u003e\u003c/em\u003e is one of:\u003c/span\u003e\n\n    ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED }\n    READ WRITE | READ ONLY\n    [ NOT ] DEFERRABLE","synopsis_text":"START TRANSACTION [ transaction_mode [, ...] ]\n\nwhere transaction_mode is one of:\n\nISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED }\nREAD WRITE | READ ONLY\n[ NOT ] DEFERRABLE"},"ManualEvidence":{},"MeasuredEvidence":{}},"Text":{"Collection":"sql","Key":"start-transaction","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"START TRANSACTION","Summary":"开始一个事务块","BodyHTML":"\u003cpre\u003eSTART TRANSACTION [ transaction_mode [, ...] ]\n\n其中 transaction_mode 是下列之一：\n\nISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED }\nREAD WRITE | READ ONLY\n[ NOT ] DEFERRABLE\u003c/pre\u003e\u003csection\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e该命令开始一个新的事务块。如果指定了隔离级别、读写模式或可延迟模式，新事务就会具有这些特性，就像执行了 \u003ca href=\"/docs/18/sql-set-transaction.html\" title=\"SET TRANSACTION\" rel=\"nofollow\"\u003e\u003ccode\u003eSET TRANSACTION\u003c/code\u003e\u003c/a\u003e一样。它与\u003ca href=\"/docs/18/sql-begin.html\" title=\"BEGIN\" rel=\"nofollow\"\u003e\u003ccode\u003eBEGIN\u003c/code\u003e\u003c/a\u003e命令具有相同功能。\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e参数\u003c/h2\u003e\u003cp\u003e关于本语句参数含义的信息，参见\u003ca href=\"/docs/18/sql-set-transaction.html\" title=\"SET TRANSACTION\" rel=\"nofollow\"\u003e\u003cspan\u003eSET TRANSACTION\u003c/span\u003e\u003c/a\u003e。\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e兼容性\u003c/h2\u003e\u003cp\u003e在 SQL 标准中，并不需要发出\u003ccode\u003eSTART TRANSACTION\u003c/code\u003e 来开始一个事务块：任何 SQL 命令都会隐式开始一个事务块。\u003cspan\u003ePostgreSQL\u003c/span\u003e的行为可以看作是：对每条不跟在 \u003ccode\u003eSTART TRANSACTION\u003c/code\u003e（或\u003ccode\u003eBEGIN\u003c/code\u003e）之后的命令，都会在其后隐式发出一个\u003ccode\u003eCOMMIT\u003c/code\u003e，因此这种行为通常被称为\u003cspan\u003e“\u003cspan\u003e自动提交\u003c/span\u003e”\u003c/span\u003e。其他关系型数据库系统也可能为了方便而提供自动提交特性。\u003c/p\u003e\u003cp\u003e\u003ccode\u003eDEFERRABLE\u003c/code\u003e \u003cem\u003e\u003ccode\u003etransaction_mode\u003c/code\u003e\u003c/em\u003e 是\u003cspan\u003ePostgreSQL\u003c/span\u003e的一种语言扩展。\u003c/p\u003e\u003cp\u003eSQL 标准要求在连续的\u003cem\u003e\u003ccode\u003etransaction_modes\u003c/code\u003e\u003c/em\u003e之间有逗号，但出于历史原因，\u003cspan\u003ePostgreSQL\u003c/span\u003e允许省略逗号。\u003c/p\u003e\u003cp\u003e另见\u003ca href=\"/docs/18/sql-set-transaction.html\" title=\"SET TRANSACTION\" rel=\"nofollow\"\u003e\u003cspan\u003eSET TRANSACTION\u003c/span\u003e\u003c/a\u003e的兼容性小节。\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e另见\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/wiki/sql/begin/?v=18\" title=\"BEGIN\" rel=\"nofollow\"\u003e\u003cspan\u003eBEGIN\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/commit/?v=18\" title=\"COMMIT\" rel=\"nofollow\"\u003e\u003cspan\u003eCOMMIT\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/rollback/?v=18\" title=\"ROLLBACK\" rel=\"nofollow\"\u003e\u003cspan\u003eROLLBACK\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/savepoint/?v=18\" title=\"SAVEPOINT\" rel=\"nofollow\"\u003e\u003cspan\u003eSAVEPOINT\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/set-transaction/?v=18\" title=\"SET TRANSACTION\" rel=\"nofollow\"\u003e\u003cspan\u003eSET TRANSACTION\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","SourceRevision":"1b5ca64c","ContentHash":"385c39cecd4cc258238750ac91f8c2748e961443553696e47f5cca4b7b0dddc1","Payload":{"purpose_zh":"开始一个事务块","sections":[{"html":"\u003cp\u003e该命令开始一个新的事务块。如果指定了隔离级别、读写模式或可延迟模式，新事务就会具有这些特性，就像执行了 \u003ca href=\"/docs/18/sql-set-transaction.html\" title=\"SET TRANSACTION\"\u003e\u003ccode class=\"command\"\u003eSET TRANSACTION\u003c/code\u003e\u003c/a\u003e一样。它与\u003ca href=\"/docs/18/sql-begin.html\" title=\"BEGIN\"\u003e\u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e\u003c/a\u003e命令具有相同功能。\u003c/p\u003e","key":"description","title":"描述"},{"html":"\u003cp\u003e关于本语句参数含义的信息，参见\u003ca href=\"/docs/18/sql-set-transaction.html\" title=\"SET TRANSACTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eSET TRANSACTION\u003c/span\u003e\u003c/a\u003e。\u003c/p\u003e","key":"parameters","title":"参数"},{"html":"\u003cp\u003e在 SQL 标准中，并不需要发出\u003ccode class=\"command\"\u003eSTART TRANSACTION\u003c/code\u003e 来开始一个事务块：任何 SQL 命令都会隐式开始一个事务块。\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e的行为可以看作是：对每条不跟在 \u003ccode class=\"command\"\u003eSTART TRANSACTION\u003c/code\u003e（或\u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e）之后的命令，都会在其后隐式发出一个\u003ccode class=\"command\"\u003eCOMMIT\u003c/code\u003e，因此这种行为通常被称为\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e自动提交\u003c/span\u003e”\u003c/span\u003e。其他关系型数据库系统也可能为了方便而提供自动提交特性。\u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003eDEFERRABLE\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003etransaction_mode\u003c/code\u003e\u003c/em\u003e 是\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e的一种语言扩展。\u003c/p\u003e\u003cp\u003eSQL 标准要求在连续的\u003cem class=\"replaceable\"\u003e\u003ccode\u003etransaction_modes\u003c/code\u003e\u003c/em\u003e之间有逗号，但出于历史原因，\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e允许省略逗号。\u003c/p\u003e\u003cp\u003e另见\u003ca href=\"/docs/18/sql-set-transaction.html\" title=\"SET TRANSACTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eSET TRANSACTION\u003c/span\u003e\u003c/a\u003e的兼容性小节。\u003c/p\u003e","key":"compatibility","title":"兼容性"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/begin/?v=18\" title=\"BEGIN\"\u003e\u003cspan class=\"refentrytitle\"\u003eBEGIN\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/commit/?v=18\" title=\"COMMIT\"\u003e\u003cspan class=\"refentrytitle\"\u003eCOMMIT\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/rollback/?v=18\" title=\"ROLLBACK\"\u003e\u003cspan class=\"refentrytitle\"\u003eROLLBACK\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/savepoint/?v=18\" title=\"SAVEPOINT\"\u003e\u003cspan class=\"refentrytitle\"\u003eSAVEPOINT\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/set-transaction/?v=18\" title=\"SET TRANSACTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eSET TRANSACTION\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"另见"}],"sections_same_as":"","synopsis_html":"START TRANSACTION [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003etransaction_mode\u003c/code\u003e\u003c/em\u003e [, ...] ]\n\n\u003cspan class=\"phrase\"\u003e其中 \u003cem class=\"replaceable\"\u003e\u003ccode\u003etransaction_mode\u003c/code\u003e\u003c/em\u003e 是下列之一：\u003c/span\u003e\n\n    ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED }\n    READ WRITE | READ ONLY\n    [ NOT ] DEFERRABLE","synopsis_text":"START TRANSACTION [ transaction_mode [, ...] ]\n\n其中 transaction_mode 是下列之一：\n\nISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED }\nREAD WRITE | READ ONLY\n[ NOT ] DEFERRABLE"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","7.3","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
