Re: RE : full featured alter table? - Mailing list pgsql-general

From Sven Köhler
Subject Re: RE : full featured alter table?
Date
Msg-id bcku6k$hnm$1@main.gmane.org
Whole thread Raw
In response to Re: RE : full featured alter table?  ("Jim C. Nasby" <jim@nasby.net>)
Responses Re: RE : full featured alter table?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
>>ALTER TABLE <table> ALTER COLUMN <column> POSITION <int i>
>>
>>where 1<=i<=number of cols in table and the given column will be moved
>>between the (i-1)-th and the i-th column within the table.
>
> I think that's fine. I think the normal case for doing this will be
> after you've added a new column, I think it would be pretty rare to want
> to re-order everything in the table. Of course if you did want to
> re-order everything in the table, it would be easier to just specify the
> list of column names in the new order you'd like to see them in.

perhaps we could also think about a
ALTER TABLE <table> POSITIONS <column1>,<column2>,...

but that is unnessary in my eyes. To issue 15 statements to re-order a
complete table shouldn't be a problem. (assuming our table has 15 columns)

>>if a admin-tool wants to redefine the order of the columns, it just has
>>to submit one command for every column with ascending positions.
>
> BTW, I've heard a lot of people talking about 'dragging columns around
> in select output', and I don't think that's a very good use case for
> this. The order of columns should be considered to be part of the table
> definition. Changing it should require the same privledges as adding or
> dropping a column. If a front-end wants to provide some wiz-bang
> interface customization on a per-user basis this isn't the mechanism
> that should be used.

Of course the described command should require the priviledge for
modifying a table. I think we don't want any user to be abled to do
that, because that will lead to chaos.


pgsql-general by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: include shell commands in query
Next
From: Bruce Momjian
Date:
Subject: Re: Finding Current Page Size