Re: Assertion failure on UNLOGGED VIEW and SEQUENCE

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Assertion failure on UNLOGGED VIEW and SEQUENCE
Дата
Msg-id AANLkTik=ER4L5xuAxM8rahacFNm1Gn6tbSZ7DnAGutLN@mail.gmail.com
обсуждение исходный текст
Ответ на Assertion failure on UNLOGGED VIEW and SEQUENCE  (Itagaki Takahiro <itagaki.takahiro@gmail.com>)
Ответы Re: Assertion failure on UNLOGGED VIEW and SEQUENCE  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Fri, Feb 18, 2011 at 6:42 AM, Itagaki Takahiro
<itagaki.takahiro@gmail.com> wrote:
> UNLOGGED is defigned in OptTemp in gram.y, so the parser accepts
> CREATE UNLOGGED VIEW and CREATE UNLOGGED SEQUENCE, but they are
> actually not supported.
>
> =# CREATE UNLOGGED VIEW uv AS SELECT 1;
> TRAP: FailedAssertion("!(relkind == 'r' || relkind == 't')", File:
> "heap.c", Line: 1246)
>
> =# CREATE UNLOGGED SEQUENCE us;
> TRAP: FailedAssertion("!(relkind == 'r' || relkind == 't')", File:
> "heap.c", Line: 1246)
>
> The most easiest fix would be preventing them in parser level.

Well, that sucks.  I had intended for that to be disallowed at the
parser level, but obviously I fail.  It seems that disallowing this in
the parser will require duplicating the OptTemp production.  Or
alternatively we can just add an error check to the CREATE VIEW and
CREATE SEQUENCE productions, i.e.

if ($4 == RELPERSISTENCE_UNLOGGED)   ereport(ERROR, ...);

I am somewhat leaning toward the latter option, to avoid unnecessarily
bloating the size of the parser tables, but I can do it the other way
if people prefer.

In scrutinizing this code again, I notice that I accidentally added
the ability to create an unlogged table using SELECT INTO, as in
"SELECT 1 INTO UNLOGGED foo", just as you can also do "SELECT 1 INTO
TEMP foo".  I don't see any particular reason to disallow that, but I
should probably update the documentation.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: WIP - Add ability to constrain backend temporary file space
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Separate messages for standby replies and hot standby feedback.