Re: Removing pg_migrator limitations

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Stark <gsstark(at)mit(dot)edu>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Subject: Re: Removing pg_migrator limitations
Date: 2009-12-24 16:03:40
Message-ID: 200912241603.nBOG3ef10665@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian wrote:
> Bruce Momjian wrote:
> > I looked at DefineEnum() and basically adding the ability to add enums
> > would put the new enum after the existing ones unless the OID counter
> > has wrapped around and is less than the oid counter at the time the enum
> > type was created, in which case it will be listed as before the existing
> > values. I wasn't aware enum ordering is something we tried to maintain.
> > One issue is that we are not supporting the addition of enum values even
> > for people who don't care about the ordering of enums (which I bet might
> > be the majority.)
> >
> > I can think of a few approaches for pg_migrator:
> >
> > 1) Create an oid array in a permanent memory context and have
> > DefineEnum() read from that.
> > 2) Renumber the enum entries after they are created but before
> > any of their oids are stored in user tables.
> >
> > Both can be done by pg_dump with proper server-side functions. The
> > problem with #2 are cases where the old and new oid ranges overlap,
> > e.g.:
>
> I now think the easiest solution will be to have pg_dump create the enum
> with a single dummy value, delete the pg_enum dummy row, and then call a
> modified version of EnumValuesCreate() to insert row by row into
> pg_enum, with specified oids.

I thought of a cleaner approach. CREATE TYPE ENUM will create one enum
with the specified oid, and then a server-side function will call
EnumValuesCreate() be used to add each additional enum with a specified
oid --- no deleting necessary. I will start working on a patch for
this.

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

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2009-12-24 16:08:49 Re: Update ppport.h in plperl
Previous Message Fujii Masao 2009-12-24 15:47:34 Re: Backup history file should be replicated in Streaming Replication?