|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.304 2002/10/18 22:05:35 petere Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.305 2002/10/19 20:15:09 tgl Exp $ |
12 | 12 | *
|
13 | 13 | * NOTES
|
14 | 14 | * this is the "main" module of the postgres backend and
|
@@ -756,16 +756,30 @@ pg_exec_query_string(StringInfo query_string, /* string to execute */
|
756 | 756 |
|
757 | 757 | elog(DEBUG2, "ProcessUtility");
|
758 | 758 |
|
759 |
| - /* set snapshot if utility stmt needs one */ |
760 |
| - /* XXX maybe cleaner to list those that shouldn't set one? */ |
761 |
| - if (IsA(utilityStmt, AlterTableStmt) || |
762 |
| - IsA(utilityStmt, ClusterStmt) || |
763 |
| - IsA(utilityStmt, CopyStmt) || |
764 |
| - IsA(utilityStmt, ExecuteStmt) || |
765 |
| - IsA(utilityStmt, ExplainStmt) || |
766 |
| - IsA(utilityStmt, IndexStmt) || |
767 |
| - IsA(utilityStmt, PrepareStmt) || |
768 |
| - IsA(utilityStmt, ReindexStmt)) |
| 759 | + /* |
| 760 | + * Set snapshot if utility stmt needs one. Most reliable |
| 761 | + * way to do this seems to be to enumerate those that do not |
| 762 | + * need one; this is a short list. Transaction control, |
| 763 | + * LOCK, and SET must *not* set a snapshot since they need |
| 764 | + * to be executable at the start of a serializable transaction |
| 765 | + * without freezing a snapshot. By extension we allow SHOW |
| 766 | + * not to set a snapshot. The other stmts listed are just |
| 767 | + * efficiency hacks. Beware of listing anything that can |
| 768 | + * modify the database --- if, say, it has to update a |
| 769 | + * functional index, then it had better have a snapshot. |
| 770 | + */ |
| 771 | + if (! (IsA(utilityStmt, TransactionStmt) || |
| 772 | + IsA(utilityStmt, LockStmt) || |
| 773 | + IsA(utilityStmt, VariableSetStmt) || |
| 774 | + IsA(utilityStmt, VariableShowStmt) || |
| 775 | + IsA(utilityStmt, VariableResetStmt) || |
| 776 | + IsA(utilityStmt, ConstraintsSetStmt) || |
| 777 | + /* efficiency hacks from here down */ |
| 778 | + IsA(utilityStmt, FetchStmt) || |
| 779 | + IsA(utilityStmt, ListenStmt) || |
| 780 | + IsA(utilityStmt, NotifyStmt) || |
| 781 | + IsA(utilityStmt, UnlistenStmt) || |
| 782 | + IsA(utilityStmt, CheckPointStmt))) |
769 | 783 | SetQuerySnapshot();
|
770 | 784 |
|
771 | 785 | /* end transaction block if transaction or variable stmt */
|
@@ -1769,7 +1783,7 @@ PostgresMain(int argc, char *argv[], const char *username)
|
1769 | 1783 | if (!IsUnderPostmaster)
|
1770 | 1784 | {
|
1771 | 1785 | puts("\nPOSTGRES backend interactive interface ");
|
1772 |
| - puts("$Revision: 1.304 $ $Date: 2002/10/18 22:05:35 $\n"); |
| 1786 | + puts("$Revision: 1.305 $ $Date: 2002/10/19 20:15:09 $\n"); |
1773 | 1787 | }
|
1774 | 1788 |
|
1775 | 1789 | /*
|
|
0 commit comments