pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Rod Taylor <pg@rbt.ca>
Cc: Markus Bertheau <mbertheau.pg@googlemail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: alter column type from boolean to char with default
Date: Wed, 02 Aug 2006 12:36:59 -0400
Message-ID: <18063.1154536619@sss.pgh.pa.us> (raw)
In-Reply-To: <1154526983.29712.223.camel@home>
References: <684362e10608020546t16e6d3e8nf6756abd15a21a68@mail.gmail.com>
	<15041.1154524770@sss.pgh.pa.us>
	<1154526983.29712.223.camel@home>

Rod Taylor <pg@rbt.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



view thread (6+ messages)  latest in thread

Message-ID: <18063.1154536619@sss.pgh.pa.us>
Permalink:  ../18063.1154536619@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/18063.1154536619@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pg@rbt.ca, mbertheau.pg@googlemail.com
  Subject: Re: alter column type from boolean to char with default
  In-Reply-To: <18063.1154536619@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox