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


Reply via email to