Re: [BUGS] BUG #14825: enum type: unsafe use? - Mailing list pgsql-bugs

From Tom Lane
Subject Re: [BUGS] BUG #14825: enum type: unsafe use?
Date
Msg-id 15165.1506116768@sss.pgh.pa.us
Whole thread Raw
In response to [BUGS] BUG #14825: enum type: unsafe use?  (balazs@obiserver.hu)
Responses Re: [BUGS] BUG #14825: enum type: unsafe use?
List pgsql-bugs
balazs@obiserver.hu writes:
> PostgreSQL version: 10beta4

> testdb=# begin;
> BEGIN
> testdb=# create type enumtype as enum ('v1', 'v2');
> CREATE TYPE
> testdb=# alter type enumtype owner to testrole;
> ALTER TYPE
> testdb=# create table testtable (enumcolumn enumtype not null default 'v1');
> ERROR:  unsafe use of new value "v1" of enum type enumtype
> HINT:  New enum values must be committed before they can be used.

Hmm, that's pretty annoying.  It's happening because check_safe_enum_use
insists that the enum's pg_type entry not be updated-in-transaction.
We thought that the new rules instituted by 15bc038f9 would be generally
more convenient to use than the old ones --- but this example shows
that, for example, pg_dump scripts involving enums often could not
be restored inside a single transaction.

I'm not sure if that qualifies as a stop-ship problem, but it ain't
good, for sure.  We need to look at whether we should revert 15bc038f9
or somehow revise its rules.
        regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

pgsql-bugs by date:

Previous
From: balazs@obiserver.hu
Date:
Subject: [BUGS] BUG #14825: enum type: unsafe use?
Next
From: Joel Hoffman
Date:
Subject: [BUGS] Multiple evaluation of single reference to function with out parameters