Re: [SQL] alter column type from boolean to char with default

2006-08-03 Thread Andrew Hammond
Tom Lane wrote: Rod Taylor [EMAIL PROTECTED] writes: On Wed, 2006-08-02 at 09:19 -0400, Tom Lane wrote: Hmm ... the way I would have expected to work is alter table posts alter column deleted drop default, alter column deleted type char(1) using (case when deleted then 't' else 'f'

Re: [SQL] alter column type from boolean to char with default

2006-08-03 Thread Tom Lane
Andrew Hammond [EMAIL PROTECTED] writes: Alternatively, you already have the USING clause to tell you how to alter the data. How about using it to alter the default as well? The reasons not to do that are already set forth in the ALTER TABLE man page. regards, tom lane

[SQL] alter column type from boolean to char with default doesn't work

2006-08-02 Thread Markus Bertheau
Hi, I basically want to change a boolean column to char. The boolean column has a default of true. The char column should have 'f' for false and 't' for true. I think that an SQL statement like the following should work, but it doesn't: blog= select version();

Re: [SQL] alter column type from boolean to char with default doesn't work

2006-08-02 Thread Tom Lane
Markus Bertheau [EMAIL PROTECTED] writes: I basically want to change a boolean column to char. The boolean column has a default of true. The char column should have 'f' for false and 't' for true. I think that an SQL statement like the following should work, but it doesn't: Hmm ... the way I

Re: [SQL] alter column type from boolean to char with default

2006-08-02 Thread Rod Taylor
On Wed, 2006-08-02 at 09:19 -0400, Tom Lane wrote: Markus Bertheau [EMAIL PROTECTED] writes: I basically want to change a boolean column to char. The boolean column has a default of true. The char column should have 'f' for false and 't' for true. I think that an SQL statement like the

Re: [SQL] alter column type from boolean to char with default

2006-08-02 Thread Tom Lane
Rod Taylor [EMAIL PROTECTED] writes: On Wed, 2006-08-02 at 09:19 -0400, Tom Lane wrote: Hmm ... the way I would have expected to work is alter table posts alter column deleted drop default, alter column deleted type char(1) using (case when deleted then 't' else 'f' end), alter column