aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/parser/gram.y30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 9eb1bed58e6..8389337ecc2 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -2507,15 +2507,31 @@ CreateStmt: CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')'
* Redundancy here is needed to avoid shift/reduce conflicts,
* since TEMP is not a reserved word. See also OptTempTableName.
*
- * NOTE: we accept both GLOBAL and LOCAL options; since we have no modules
- * the LOCAL keyword is really meaningless.
+ * NOTE: we accept both GLOBAL and LOCAL options. They currently do nothing,
+ * but future versions might consider GLOBAL to request SQL-spec-compliant
+ * temp table behavior, so warn about that. Since we have no modules the
+ * LOCAL keyword is really meaningless; furthermore, some other products
+ * implement LOCAL as meaning the same as our default temp table behavior,
+ * so we'll probably continue to treat LOCAL as a noise word.
*/
OptTemp: TEMPORARY { $$ = RELPERSISTENCE_TEMP; }
| TEMP { $$ = RELPERSISTENCE_TEMP; }
| LOCAL TEMPORARY { $$ = RELPERSISTENCE_TEMP; }
| LOCAL TEMP { $$ = RELPERSISTENCE_TEMP; }
- | GLOBAL TEMPORARY { $$ = RELPERSISTENCE_TEMP; }
- | GLOBAL TEMP { $$ = RELPERSISTENCE_TEMP; }
+ | GLOBAL TEMPORARY
+ {
+ ereport(WARNING,
+ (errmsg("GLOBAL is deprecated in temporary table creation"),
+ parser_errposition(@1)));
+ $$ = RELPERSISTENCE_TEMP;
+ }
+ | GLOBAL TEMP
+ {
+ ereport(WARNING,
+ (errmsg("GLOBAL is deprecated in temporary table creation"),
+ parser_errposition(@1)));
+ $$ = RELPERSISTENCE_TEMP;
+ }
| UNLOGGED { $$ = RELPERSISTENCE_UNLOGGED; }
| /*EMPTY*/ { $$ = RELPERSISTENCE_PERMANENT; }
;
@@ -8930,11 +8946,17 @@ OptTempTableName:
}
| GLOBAL TEMPORARY opt_table qualified_name
{
+ ereport(WARNING,
+ (errmsg("GLOBAL is deprecated in temporary table creation"),
+ parser_errposition(@1)));
$$ = $4;
$$->relpersistence = RELPERSISTENCE_TEMP;
}
| GLOBAL TEMP opt_table qualified_name
{
+ ereport(WARNING,
+ (errmsg("GLOBAL is deprecated in temporary table creation"),
+ parser_errposition(@1)));
$$ = $4;
$$->relpersistence = RELPERSISTENCE_TEMP;
}