Skip to content

Commit 3e6b305

Browse files
committed
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.
1 parent 1ab9b01 commit 3e6b305

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

doc/src/sgml/ref/select_into.sgml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ PostgreSQL documentation
2424
[ WITH [ RECURSIVE ] <replaceable class="parameter">with_query</replaceable> [, ...] ]
2525
SELECT [ ALL | DISTINCT [ ON ( <replaceable class="parameter">expression</replaceable> [, ...] ) ] ]
2626
* | <replaceable class="parameter">expression</replaceable> [ [ AS ] <replaceable class="parameter">output_name</replaceable> ] [, ...]
27-
INTO [ TEMPORARY | TEMP ] [ TABLE ] <replaceable class="parameter">new_table</replaceable>
27+
INTO [ TEMPORARY | TEMP | UNLOGGED ] [ TABLE ] <replaceable class="parameter">new_table</replaceable>
2828
[ FROM <replaceable class="parameter">from_item</replaceable> [, ...] ]
2929
[ WHERE <replaceable class="parameter">condition</replaceable> ]
3030
[ GROUP BY <replaceable class="parameter">expression</replaceable> [, ...] ]
@@ -65,6 +65,16 @@ SELECT [ ALL | DISTINCT [ ON ( <replaceable class="parameter">expression</replac
6565
</listitem>
6666
</varlistentry>
6767

68+
<varlistentry>
69+
<term><literal>UNLOGGED</literal></term>
70+
<listitem>
71+
<para>
72+
If specified, the table is created as an unlogged table. Refer
73+
to <xref linkend="sql-createtable"> for details.
74+
</para>
75+
</listitem>
76+
</varlistentry>
77+
6878
<varlistentry>
6979
<term><replaceable class="PARAMETER">new_table</replaceable></term>
7080
<listitem>

src/backend/commands/sequence.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ DefineSequence(CreateSeqStmt *seq)
119119
int i;
120120
NameData name;
121121

122+
/* Unlogged sequences are not implemented -- not clear if useful. */
123+
if (seq->sequence->relpersistence == RELPERSISTENCE_UNLOGGED)
124+
ereport(ERROR,
125+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
126+
errmsg("unlogged sequences are not supported")));
127+
122128
/* Check and set all option values */
123129
init_params(seq->options, true, &new, &owned_by);
124130

src/backend/commands/view.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,12 @@ DefineView(ViewStmt *stmt, const char *queryString)
465465
view->relname)));
466466
}
467467

468+
/* Unlogged views are not sensible. */
469+
if (view->relpersistence == RELPERSISTENCE_UNLOGGED)
470+
ereport(ERROR,
471+
(errcode(ERRCODE_SYNTAX_ERROR),
472+
errmsg("views cannot be unlogged because they do not have storage")));
473+
468474
/*
469475
* Create the view relation
470476
*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy