Re: RE : full featured alter table?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Sven Köhler <skoehler(at)upb(dot)de>, pgsql-general(at)postgresql(dot)org
Subject: Re: RE : full featured alter table?
Date: 2003-06-24 01:08:33
Message-ID: 200306240108.h5O18Xe26225@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Added to TODO:

o Allow columns to be reordered using ALTER ... POSITION i col1 [,col2];
have SELECT * and INSERT honor such ordering

---------------------------------------------------------------------------

Tom Lane wrote:
> =?ISO-8859-1?Q?Sven_K=F6hler?= <skoehler(at)upb(dot)de> writes:
> > perhaps we could also think about a
> > ALTER TABLE <table> POSITIONS <column1>,<column2>,...
>
> You could invent a syntax that supports both use cases, along the lines
> of
>
> ALTER ... POSITION <i> <column1> [ , <column2> ... ]
>
> with the meaning that the named columns are inserted sequentially between
> positions i-1 and i, moving them from wherever they were, and leaving
> all not-mentioned columns in their existing relative order. This
> degenerates to the same as your first proposal if one column is named,
> and at the other extreme allows all the columns to be re-ordered in one
> command.
>
> It could get a little confusing if some of the named columns previously
> occupied positions less than <i>. I'd suggest the following
> more-concrete specification:
>
> 1. <i> must be in the range 1 to (<number of columns in table> -
> <number of columns named in statement> + 1).
> 2. After the ALTER, the named columns have ordinal positions <i>, <i+1>,
> etc.
> 3. Any columns not named are placed into the remaining slots (1..i-1
> and i+nnamedcols..ntablecols) in the same relative order they had
> before.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Keary Suska 2003-06-24 01:09:43 Re: Running pg_dump under vcron
Previous Message Jan Wieck 2003-06-24 01:00:10 Re: [GENERAL] interesting PHP/MySQL thread