]> granicus.if.org Git - postgresql/commitdiff
Add ERROR msg for GLOBAL/LOCAL TEMP is not yet implemented
authorSimon Riggs <simon@2ndQuadrant.com>
Sat, 9 Jun 2012 15:35:26 +0000 (16:35 +0100)
committerSimon Riggs <simon@2ndQuadrant.com>
Sat, 9 Jun 2012 15:35:26 +0000 (16:35 +0100)
src/backend/parser/gram.y
src/test/regress/expected/create_table.out
src/test/regress/sql/create_table.sql

index 9eb1bed58e65b0a2d35a18b639ece82cf1533722..107a80512053e5f35069f7d2a0f0760440c95d50 100644 (file)
@@ -2507,15 +2507,43 @@ 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 don't accept either the GLOBAL or LOCAL options: not yet implemented.
  */
 OptTemp:       TEMPORARY                                       { $$ = RELPERSISTENCE_TEMP; }
                        | TEMP                                          { $$ = RELPERSISTENCE_TEMP; }
-                       | LOCAL TEMPORARY                       { $$ = RELPERSISTENCE_TEMP; }
-                       | LOCAL TEMP                            { $$ = RELPERSISTENCE_TEMP; }
-                       | GLOBAL TEMPORARY                      { $$ = RELPERSISTENCE_TEMP; }
-                       | GLOBAL TEMP                           { $$ = RELPERSISTENCE_TEMP; }
+                       | LOCAL TEMPORARY
+                               {
+                                       ereport(ERROR,
+                                               (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+                                                errmsg("LOCAL TEMPORARY not yet implemented"),
+                                                parser_errposition(@1)));
+                                       $$ = RELPERSISTENCE_TEMP;
+                               }
+                       | LOCAL TEMP
+                               {
+                                       ereport(ERROR,
+                                               (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+                                                errmsg("LOCAL TEMPORARY not yet implemented"),
+                                                parser_errposition(@1)));
+                                       $$ = RELPERSISTENCE_TEMP;
+                               }
+                       | GLOBAL TEMPORARY
+                               {
+                                       ereport(ERROR,
+                                               (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+                                                errmsg("GLOBAL TEMPORARY not yet implemented"),
+                                                parser_errposition(@1)));
+                                       $$ = RELPERSISTENCE_TEMP;
+                               }
+                       | GLOBAL TEMP
+                               {
+                                       ereport(ERROR,
+                                               (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+                                                errmsg("GLOBAL TEMPORARY not yet implemented"),
+                                                parser_errposition(@1)));
+                                       $$ = RELPERSISTENCE_TEMP;
+                               }
+
                        | UNLOGGED                                      { $$ = RELPERSISTENCE_UNLOGGED; }
                        | /*EMPTY*/                                     { $$ = RELPERSISTENCE_PERMANENT; }
                ;
@@ -8921,21 +8949,37 @@ OptTempTableName:
                        | LOCAL TEMPORARY opt_table qualified_name
                                {
                                        $$ = $4;
+                                       ereport(ERROR,
+                                               (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+                                                errmsg("LOCAL TEMPORARY not yet implemented"),
+                                                parser_errposition(@1)));
                                        $$->relpersistence = RELPERSISTENCE_TEMP;
                                }
                        | LOCAL TEMP opt_table qualified_name
                                {
                                        $$ = $4;
+                                       ereport(ERROR,
+                                               (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+                                                errmsg("LOCAL TEMPORARY not yet implemented"),
+                                                parser_errposition(@1)));
                                        $$->relpersistence = RELPERSISTENCE_TEMP;
                                }
                        | GLOBAL TEMPORARY opt_table qualified_name
                                {
                                        $$ = $4;
+                                       ereport(ERROR,
+                                               (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+                                                errmsg("GLOBAL TEMPORARY not yet implemented"),
+                                                parser_errposition(@1)));
                                        $$->relpersistence = RELPERSISTENCE_TEMP;
                                }
                        | GLOBAL TEMP opt_table qualified_name
                                {
                                        $$ = $4;
+                                       ereport(ERROR,
+                                               (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+                                                errmsg("GLOBAL TEMPORARY not yet implemented"),
+                                                parser_errposition(@1)));
                                        $$->relpersistence = RELPERSISTENCE_TEMP;
                                }
                        | UNLOGGED opt_table qualified_name
index d20790f9098492176dc2d3a298f4f5ec665e9323..0b2cbc734a8e6f3f2d6218abaf26f1e20be50513 100644 (file)
@@ -220,3 +220,19 @@ NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "doubly_temp_pkey
 CREATE TEMP TABLE public.temp_to_perm (a int primary key);             -- not OK
 ERROR:  cannot create temporary relation in non-temporary schema
 DROP TABLE unlogged1, public.unlogged2;
+CREATE GLOBAL TEMPORARY TABLE global_temp1 (a int, b text);            -- not yet OK
+ERROR:  GLOBAL TEMPORARY not yet implemented
+LINE 1: CREATE GLOBAL TEMPORARY TABLE global_temp1 (a int, b text);
+               ^
+CREATE GLOBAL TEMP TABLE global_temp2 (a int, b text);                 -- not yet OK
+ERROR:  GLOBAL TEMPORARY not yet implemented
+LINE 1: CREATE GLOBAL TEMP TABLE global_temp2 (a int, b text);
+               ^
+CREATE LOCAL TEMP TABLE local_temp (a int, b text);                            -- not yet OK
+ERROR:  LOCAL TEMPORARY not yet implemented
+LINE 1: CREATE LOCAL TEMP TABLE local_temp (a int, b text);
+               ^
+CREATE LOCAL TEMP TABLE local_temp (a int, b text);                            -- not yet OK
+ERROR:  LOCAL TEMPORARY not yet implemented
+LINE 1: CREATE LOCAL TEMP TABLE local_temp (a int, b text);
+               ^
index a050e8b6d1a67b71f9105f38858e6c6379e02578..ab0145531cfc9bdd3e2e6621621811958100f9cd 100644 (file)
@@ -250,3 +250,8 @@ CREATE TEMP TABLE explicitly_temp (a int primary key);                      -- also OK
 CREATE TEMP TABLE pg_temp.doubly_temp (a int primary key);             -- also OK
 CREATE TEMP TABLE public.temp_to_perm (a int primary key);             -- not OK
 DROP TABLE unlogged1, public.unlogged2;
+
+CREATE GLOBAL TEMPORARY TABLE global_temp1 (a int, b text);            -- not yet OK
+CREATE GLOBAL TEMP TABLE global_temp2 (a int, b text);                 -- not yet OK
+CREATE LOCAL TEMP TABLE local_temp (a int, b text);                            -- not yet OK
+CREATE LOCAL TEMP TABLE local_temp (a int, b text);                            -- not yet OK