From: Robert Haas Date: Tue, 22 Feb 2011 19:42:45 +0000 (-0500) Subject: Fix a couple of unlogged tables goofs. X-Git-Tag: REL9_1_ALPHA4~114 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3e6b305d9e2a4616bf69e31b0b21ebbb844ba50e;p=postgresql Fix a couple of unlogged tables goofs. "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. --- diff --git a/doc/src/sgml/ref/select_into.sgml b/doc/src/sgml/ref/select_into.sgml index 787c106a49..02266083d4 100644 --- a/doc/src/sgml/ref/select_into.sgml +++ b/doc/src/sgml/ref/select_into.sgml @@ -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 diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c index 80ad516de1..e71c311faf 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -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); diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c index 22dfc923cf..1f418e907e 100644 --- a/src/backend/commands/view.c +++ b/src/backend/commands/view.c @@ -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 *