Thread: Adding alter column syntax into postgres

Adding alter column syntax into postgres

From
"JwexlerAt MailDotCom"
Date:
Please suggest how best to propose that the following feature be added to PostgreSQL's roadmap?

Ability to "Alter column position" as described in the section "Adding alter column syntax into postgres" of
http://wiki.postgresql.org/wiki/Alter_column_position(and the two links in that section). 

Once implemented in tables, I would suggest a command perhaps similar to that in mysql
(http://trebleclick.blogspot.com/2009/02/reorder-mysql-table-columns.html)as well as adding the feature to pgadmin and
toPostgreSQL views. 

I would suggest that addition of this feature should be considered common sense.


=



Re: Adding alter column syntax into postgres

From
Alvaro Herrera
Date:
JwexlerAt MailDotCom wrote:
> Please suggest how best to propose that the following feature be added to PostgreSQL's roadmap?
> 
> Ability to "Alter column position" as described in the section "Adding alter column syntax into postgres" of
http://wiki.postgresql.org/wiki/Alter_column_position(and the two links in that section).
 

It is already on the roadmap.  You either need to do the actual work, or
convince someone else to do it for you.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


Re: Adding alter column syntax into postgres

From
Josh Berkus
Date:
Jwexler,

> Please suggest how best to propose that the following feature be added to PostgreSQL's roadmap?
>
> Ability to "Alter column position" as described in the section "Adding alter column syntax into postgres" of
http://wiki.postgresql.org/wiki/Alter_column_position(and the two links in that section).
 

Fortunately, there's already a specification discussed for this.  We'd 
like to have the ability for each column to have both a logical position 
and a physical position which are separate.  This would also allow us to 
dynamically re-arrange the columns at CREATE time for best storage 
efficiency.

It would also provide a foundation for column aliases.

However, I don't think there's much code for this yet.  Are you in a 
position to either write code, or fund work?

> Once implemented in tables, I would suggest a command perhaps similar to that in mysql
(http://trebleclick.blogspot.com/2009/02/reorder-mysql-table-columns.html)as well as adding the feature to pgadmin and
toPostgreSQL views.
 

Hmmmm.  It *might* be worth supporting that for MySQL compatibility, but 
really it hardly seems adequate to a large table where you want to 
rearrange most of the columns.  Seems like we'd need a better syntax.

> I would suggest that addition of this feature should be considered common sense.

Actually, it's not.  Column ordering is supposed to be arbitrary and 
implementation-dependent, so we're on our own here.  However, it would 
help people administer their applications ... even if it encourages bad 
application writers to continue using "SELECT *".

-- 
Josh Berkus
PostgreSQL Experts Inc.
www.pgexperts.com


Re: Adding alter column syntax into postgres

From
"JwexlerAt MailDotCom"
Date:
> Fortunately, there's already a specification discussed for this.  We'd
> like to have the ability for each column to have both a logical position
> and a physical position which are separate.  This would also allow us to
> dynamically re-arrange the columns at CREATE time for best storage
> efficiency.
>
> It would also provide a foundation for column aliases.
>
> However, I don't think there's much code for this yet.  Are you in a
> position to either write code, or fund work?

I am glad to here that there is a specification discussed. This would be a great help in administration and
organizationtasks (for example when working with a very large database using the pgadmin tool). 
I wish I were in a position for assisting with the code or funding but unfortunately am not.
Thank you for considering and I am hoping that interest in this increases and over the near-term horizon.

=
700% Massive Penny Stock Gains
We Find Penny Stocks that go up! Were the No1 Stock Newsletter Online.
http://a8-asy.a8ww.net/a8-ads/adftrclick?redirectid=6d0b4885a30374506bbb3552d9331caf