| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Rod Taylor <pg(at)rbt(dot)ca> |
| Cc: | Markus Bertheau <mbertheau(dot)pg(at)googlemail(dot)com>, pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: alter column type from boolean to char with default |
| Date: | 2006-08-02 16:36:59 |
| Message-ID: | 18063.1154536619@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
Rod Taylor <pg(at)rbt(dot)ca> 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 deleted set default 'f';
> Perhaps it is easiest to allow the user to specify the new default after
> USING?
He already did --- I don't want to add some random new syntax for this.
Maybe we could hack things so that if both an ALTER TYPE and a SET
DEFAULT operation are present, we implicitly add a DROP DEFAULT at the
start. But leave the timing of any explicitly specified DROP DEFAULT
as-is.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Aaron Bono | 2006-08-02 18:01:57 | Re: Joining a result set from four (4) tables |
| Previous Message | Scott Marlowe | 2006-08-02 16:22:54 | Re: viewing the description of tables from python DB-API |