Simon Riggs <simon(at)2ndQuadrant(dot)com> wrote:
> Joachim Wieland <joe(at)mcknight(dot)de> wrote:
>> BEGIN TRANSACTION ISOLATION LEVEL REPEATABLE READ (SNAPSHOT =
>> '000003A1-1');
>
> I don't see the need to change the BEGIN command, which is SQL
> Standard.
No, it's not standard.
To quote from our docs at:
http://www.postgresql.org/docs/9.0/interactive/sql-begin.html#AEN58214
| BEGIN is a PostgreSQL language extension. It is equivalent to the
| SQL-standard command START TRANSACTION, whose reference page
| contains additional compatibility information.
|
| Incidentally, the BEGIN key word is used for a different purpose
| in embedded SQL. You are advised to be careful about the
| transaction semantics when porting database applications.
In checking the most recent standards draft I have available, it
appears that besides embedded SQL, this keyword is also used in the
standard trigger declaration syntax. Using BEGIN to start a
transaction is a PostgreSQL extension to the standard. That said,
if we support a feature on the nonstandard BEGIN statement, we
typically add it as an extension to the standard START TRANSACTION
and SET TRANSACTION statements. Through 9.0 that consisted of
having a non-standard default for isolation level and the ability to
omit commas required by the standard. In 9.1 we added another
optional transaction property which defaults to standard behavior:
DEFERRABLE.
If we're talking about a property of a transaction, like the
transaction snapshot, it seems to me to be best to support it using
the same statements we use for other transaction properties.
-Kevin