diff options
author | Tom Lane | 2011-10-22 22:22:45 +0000 |
---|---|---|
committer | Tom Lane | 2011-10-22 22:23:30 +0000 |
commit | bb446b689b6681eb57a8a50605e119743190c4db (patch) | |
tree | 2605250c0d2a465c4ff6ef7454df4c56902759cd /src/backend/parser | |
parent | b436c72f61adf5efab435c282bfb13a29508d475 (diff) |
Support synchronization of snapshots through an export/import procedure.
A transaction can export a snapshot with pg_export_snapshot(), and then
others can import it with SET TRANSACTION SNAPSHOT. The data does not
leave the server so there are not security issues. A snapshot can only
be imported while the exporting transaction is still running, and there
are some other restrictions.
I'm not totally convinced that we've covered all the bases for SSI (true
serializable) mode, but it works fine for lesser isolation modes.
Joachim Wieland, reviewed by Marko Tiikkaja, and rather heavily modified
by Tom Lane
Diffstat (limited to 'src/backend/parser')
-rw-r--r-- | src/backend/parser/gram.y | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index e9f3896badb..e2edcde024e 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -553,8 +553,8 @@ static void processCASbits(int cas_bits, int location, const char *constrType, SAVEPOINT SCHEMA SCROLL SEARCH SECOND_P SECURITY SELECT SEQUENCE SEQUENCES SERIALIZABLE SERVER SESSION SESSION_USER SET SETOF SHARE - SHOW SIMILAR SIMPLE SMALLINT SOME STABLE STANDALONE_P START STATEMENT - STATISTICS STDIN STDOUT STORAGE STRICT_P STRIP_P SUBSTRING + SHOW SIMILAR SIMPLE SMALLINT SNAPSHOT SOME STABLE STANDALONE_P START + STATEMENT STATISTICS STDIN STDOUT STORAGE STRICT_P STRIP_P SUBSTRING SYMMETRIC SYSID SYSTEM_P TABLE TABLES TABLESPACE TEMP TEMPLATE TEMPORARY TEXT_P THEN TIME TIMESTAMP @@ -1352,6 +1352,15 @@ set_rest: /* Generic SET syntaxes: */ n->args = list_make1(makeStringConst($3 == XMLOPTION_DOCUMENT ? "DOCUMENT" : "CONTENT", @3)); $$ = n; } + /* Special syntaxes invented by PostgreSQL: */ + | TRANSACTION SNAPSHOT Sconst + { + VariableSetStmt *n = makeNode(VariableSetStmt); + n->kind = VAR_SET_MULTI; + n->name = "TRANSACTION SNAPSHOT"; + n->args = list_make1(makeStringConst($3, @3)); + $$ = n; + } ; var_name: ColId { $$ = $1; } |