Fix a couple of unlogged tables goofs.
authorRobert Haas
Tue, 22 Feb 2011 19:42:45 +0000 (14:42 -0500)
committerRobert Haas
Tue, 22 Feb 2011 19:46:19 +0000 (14:46 -0500)
"SELECT ... INTO UNLOGGED tabname" works, but wasn't documented; CREATE
UNLOGGED SEQUENCE and CREATE UNLOGGED VIEW failed an assertion, instead
of throwing a sensible error.

Latter issue reported by Itagaki Takahiro; patch review by Tom Lane.

doc/src/sgml/ref/select_into.sgml
src/backend/commands/sequence.c
src/backend/commands/view.c

index 787c106a49d5089d783b747560b859bb758f5638..02266083d4e798b62121f25e72373dd54541d94a 100644 (file)
@@ -24,7 +24,7 @@ PostgreSQL documentation
 [ WITH [ RECURSIVE ] with_query [, ...] ]
 SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]
     * | expression [ [ AS ] output_name ] [, ...]
-    INTO [ TEMPORARY | TEMP ] [ TABLE ] new_table
+    INTO [ TEMPORARY | TEMP | UNLOGGED ] [ TABLE ] new_table
     [ FROM from_item [, ...] ]
     [ WHERE condition ]
     [ GROUP BY expression [, ...] ]
@@ -65,6 +65,16 @@ SELECT [ ALL | DISTINCT [ ON ( expression
    
   
 
+  
+   UNLOGGED
+   
+    
+     If specified, the table is created as an unlogged table.  Refer
+     to  for details.
+    
+   
+  
+
    
     new_table
     
index 80ad516de1f17b4b517ffdf8e43d6c96cc1fede6..e71c311faf732a3387bd308690a4014a373cf1c4 100644 (file)
@@ -119,6 +119,12 @@ DefineSequence(CreateSeqStmt *seq)
    int         i;
    NameData    name;
 
+   /* Unlogged sequences are not implemented -- not clear if useful. */
+   if (seq->sequence->relpersistence == RELPERSISTENCE_UNLOGGED)
+       ereport(ERROR,
+               (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+                errmsg("unlogged sequences are not supported")));
+
    /* Check and set all option values */
    init_params(seq->options, true, &new, &owned_by);
 
index 22dfc923cf606fa8914caea87c76cca6b0f928c4..1f418e907ead9fbf64cb3f481f6fc8019a832970 100644 (file)
@@ -465,6 +465,12 @@ DefineView(ViewStmt *stmt, const char *queryString)
                        view->relname)));
    }
 
+   /* Unlogged views are not sensible. */
+   if (view->relpersistence == RELPERSISTENCE_UNLOGGED)
+       ereport(ERROR,
+               (errcode(ERRCODE_SYNTAX_ERROR),
+                errmsg("views cannot be unlogged because they do not have storage")));
+
    /*
     * Create the view relation
     *