Re: best practice transitioning from one datatype to another

From: Arndt Lehmann <arndt(dot)lehmann(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: best practice transitioning from one datatype to another
Date: 2009-07-16 09:22:26
Message-ID: 8abf816b-d93d-473e-b64f-70aa10a248c7@12g2000pri.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Jul 16, 5:46 pm, a(dot)w(dot)(dot)(dot)(at)netzmeister-st-pauli(dot)de (Andreas Wenk)
wrote:
> Arndt Lehmann schrieb:
>
> > On Jul 16, 8:05 am, t(dot)(dot)(dot)(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane) wrote:
> >> CG <cgg(dot)(dot)(dot)(at)yahoo(dot)com> writes:
> >>> While transitioning from 8.1 to 8.4, I need to transition to the internal UUID type in place of the contrib/uniqueidentifier module. I've built the database around uniqueidentifier, so nearly every table has one column of that data type. It's going to be tedious to
> >>> ALTER TABLE foo ALTER COLUMN bar SET DATA TYPE uuid;
> >>> ...repeat 600 times...
> >>> I'll also have to drop and reload the views and the rules on tables. It'll be tedious even if the tables have no data in them.
> >>> Can anyone recommend a better/faster way to make the transition?
> >> Couldn't you rename the type to uuid in the 8.1 database before you
> >> dump?
>
> >>                         regards, tom lane
>
> >> --
> >> Sent via pgsql-general mailing list (pgsql-gene(dot)(dot)(dot)(at)postgresql(dot)org)
> >> To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-general
>
> > Just an idea - don't know if it works, first try on a test server:
> > 1. Dump the complete database into text format (pg_dump --format=t)
> > 2. Do a search and replace from "uniqueidentifier" to "uuid"
> > 3. Reimport
>
> > Best Regards,
> >   Arndt Lehmann
>
> uh - --format=t means tar format. --format=p means plain text ...
>
> Or am I missing something?
>
> $pg_dump --help
> Usage:
>    pg_dump [OPTION]... [DBNAME]
>
> General options:
> ...
>    -F, --format=c|t|p       output file format (custom, tar, plain text)
> ...
>
> Cheers
>
> Andy
>
> --
> Sent via pgsql-general mailing list (pgsql-gene(dot)(dot)(dot)(at)postgresql(dot)org)
> To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-general

Hi Andy,

You are perfectly right. My oversight.

Best Regards,
Arndt Lehmannn

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andres Freund 2009-07-16 09:24:59 Re: overwrite the encoding of a database
Previous Message Albe Laurenz 2009-07-16 09:15:24 Re: [PERFORM] Concurrency issue under very heay loads