Re: --single-transaction hack to pg_upgrade does not work
От | Andres Freund |
---|---|
Тема | Re: --single-transaction hack to pg_upgrade does not work |
Дата | |
Msg-id | 20121201185105.GE31780@alap2 обсуждение исходный текст |
Ответ на | Re: --single-transaction hack to pg_upgrade does not work (Bruce Momjian <bruce@momjian.us>) |
Ответы |
Re: --single-transaction hack to pg_upgrade does not work
|
Список | pgsql-hackers |
On 2012-12-01 13:43:44 -0500, Bruce Momjian wrote: > On Sat, Dec 1, 2012 at 07:32:48PM +0100, Andres Freund wrote: > > On 2012-12-01 12:14:37 -0500, Tom Lane wrote: > > > Andres Freund <andres@2ndquadrant.com> writes: > > > > On 2012-12-01 12:00:46 -0500, Tom Lane wrote: > > > >> ISTM this sort of thing ought to be safe enough, though you probably > > > >> need to insist both that the pg_type row's xmin be current XID and > > > >> that it not be HEAP_UPDATED. > > > > > > > I was concerned about updated rows but forgot about HEAP_UPDATED. So I > > > > thought that it would be possible to alter the type in some generic > > > > fashion (e.g. change owner) and then add new values. > > > > > > Yeah, I was just thinking about that: we'd have to fail if pg_dump > > > emitted CREATE TYPE, ALTER TYPE OWNER, and then tried to add more > > > values. Fortunately it doesn't do that; the ADD VALUE business is > > > just a multi-statement expansion of CREATE TYPE AS ENUM, and any > > > other ALTERs will come afterwards. > > > > Well, there's a binary_upgrade.set_next_pg_enum_oid() inbetween, but thats > > luckily just fine. > > Do we need a comment in pg_dump.c to make sure that doesn't change? We could, but I don't really see it likely that somethig problematic will be added there the regression tests should catch any problem there (right?). > > > > Let me provide something a littlebit more mature. > > > > > > It could do with some comments ;-) > > > > Hehe, yes. Hopefully this version has enough of that. > > I believe this text in alter_type.sgml need updating: > > <command>ALTER TYPE ... ADD VALUE</> (the form that adds a new value to an > enum type) cannot be executed inside a transaction block. I purposefully didn't change that because the new support is rather minimalistic. E.g. BEGIN; CREATE TYPE foo AS ENUM(); ALTER TYPE foo RENAME TO bar; ALTER TYPE bar ADD VALUE 'blub'; COMMIT; is not going to work. So it seems best not to make it something official but keep it as an extension for pg_upgrade support. (btw, the commit message inside the git am'able patch contained that explanation...) Greetings, Andres Freund --Andres Freund http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services
В списке pgsql-hackers по дате отправления: