Only postgresql 8 and above, which is still in unstable/experimental (debian) allow column type altering.
This is not an option for users running 7.x.

The only way to do this right in 7.x is to create a new table, insert all data into the new table, delete the old table and rename the new one. The old table should obviously be blocked propperly before beginning.

Kind regards,

Marc



Op 6-apr-2006, om 19:20 heeft Matthew Sayler het volgende geschreven:

On Thu, Apr 06, 2006 at 06:53:25PM +0200, Paul J Stevens wrote:
Perhaps some postgres dba/guru here knows how to do this gracefully:

in dbmail-2.1 the type for the messageblk column in dbmail_messageblks
has been changed from TEXT to BYTEA to accomodate true binary data.

I'm beginning to suspect this may/will lead to problems for people
upgrading from 2.0 to 2.1 while using postgres storage.

So how can we provide a (preferably sql based) migration to change the
column type?

No postgres knowledge here, but:

http://www.postgresql.org/docs/8.1/static/sql-altertable.html

The following syntax allows column altering with functions

ALTER TABLE foo
    ALTER COLUMN foo_timestamp TYPE timestamp with time zone
        USING
                timestamp with time zone 'epoch' + foo_timestamp *
                interval '1 second';

We should be able to cook something up with encode() and friends.

Matt


_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://twister.fastxs.net/mailman/listinfo/dbmail-dev


Reply via email to