Adding alter column syntax into postgres

Lists: pgsql-hackers
From: "JwexlerAt MailDotCom" <jwexler(at)mail(dot)usa(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Adding alter column syntax into postgres
Date: 2009-08-04 00:17:20
Message-ID: 20090804001720.2031823F14C@ws3-4.us4.outblaze.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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 to PostgreSQL views.

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

=


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: JwexlerAt MailDotCom <jwexler(at)mail(dot)usa(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Adding alter column syntax into postgres
Date: 2009-08-04 00:55:29
Message-ID: 20090804005529.GL19615@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: JwexlerAt MailDotCom <jwexler(at)mail(dot)usa(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Adding alter column syntax into postgres
Date: 2009-08-04 00:58:58
Message-ID: 4A7787D2.8060709@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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 to PostgreSQL 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