Re: --single-transaction hack to pg_upgrade does not work

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: --single-transaction hack to pg_upgrade does not work
Date: 2012-12-01 18:43:44
Message-ID: 20121201184344.GO27120@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)2ndquadrant(dot)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?

> > > 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.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2012-12-01 18:51:05 Re: --single-transaction hack to pg_upgrade does not work
Previous Message Andres Freund 2012-12-01 18:34:51 Re: ALTER TABLE ... NOREWRITE option