Re: Adding alter column syntax into postgres

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
Thread:
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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2009-08-04 01:02:01 Re: bytea vs. pg_dump
Previous Message Alvaro Herrera 2009-08-04 00:55:29 Re: Adding alter column syntax into postgres