Postgres- For compatibility reasons we don't drop columns but rename them?
From the documentation of hook_update_N(): Dropping a column: MySQL: ALTER TABLE {$table} DROP $column Postgres: ALTER TABLE {$table} RENAME $column TO $column_old // For compatibility reasons we don't drop columns but rename them Why do we do this? What compatibility reasons? -- Neil Drumm http://delocalizedham.com/
On 12/16/05, Neil Drumm <drumm@delocalizedham.com> wrote:
Postgres: ALTER TABLE {$table} RENAME $column TO $column_old // For compatibility reasons we don't drop columns but rename them
Why do we do this? What compatibility reasons?
It's been a while since I dealt with any of our pg stuff at work, but I think Postgres doesn't actually allow you to drop columns... You would have to create a new table without the column, and then move all the data over. Could be completely off-base though! -Rowan
On Fri, Dec 16, 2005 at 10:01:09PM -0500, Rowan Kerr wrote:
On 12/16/05, Neil Drumm <drumm@delocalizedham.com> wrote:
Postgres: ALTER TABLE {$table} RENAME $column TO $column_old // For compatibility reasons we don't drop columns but rename them
Why do we do this? What compatibility reasons?
It's been a while since I dealt with any of our pg stuff at work, but I think Postgres doesn't actually allow you to drop columns... You would have to create a new table without the column, and then move all the data over.
Could be completely off-base though!
Well, this is not the case in any recent versions of PostgreSQL; DROP COLUMN works fine on all of the installations I have access to (7.4 and 8.0 series). According to the docs[0], 7.3 supported it as well. Could still be true for even older versions, I suppose. Is there a documented minimum requirement? -- Keegan Quinn <keegan@thebasement.org> CEO, Producer the basement productions http://www.thebasement.org [0] http://www.postgresql.org/docs/7.3/interactive/ddl-alter.html#AEN1977
On 12/16/05, Keegan Quinn <keegan@thebasement.org> wrote:
Well, this is not the case in any recent versions of PostgreSQL; DROP COLUMN works fine on all of the installations I have access to (7.4 and 8.0 series). According to the docs[0], 7.3 supported it as well.
Could still be true for even older versions, I suppose. Is there a documented minimum requirement?
http://drupal.org/node/270 Minimum supported according to documentation is pg7.3 with 7.2 at a "might work, but probably better to try for mroe..." kind of status. Of course, it's not clear to me what the compatability reason was, exactly, though it's reasonable that PG didn't support dropping columns at some point. Greg
On 17 Dec 2005, at 7:19 AM, Greg Knaddison wrote:
Minimum supported according to documentation is pg7.3 with 7.2 at a "might work, but probably better to try for mroe..." kind of status.
It was a new feature in 7.4 or 7.3. -- Adrian Rossouw Drupal developer and Bryght Guy http://drupal.org | http://bryght.com
Rowan Kerr wrote:
On 12/16/05, Neil Drumm <drumm@delocalizedham.com> wrote:
Postgres: ALTER TABLE {$table} RENAME $column TO $column_old // For compatibility reasons we don't drop columns but rename them
Why do we do this? What compatibility reasons?
It's been a while since I dealt with any of our pg stuff at work, but I think Postgres doesn't actually allow you to drop columns... You would have to create a new table without the column, and then move all the data over.
Could be completely off-base though!
-Rowan
Postgres 7.4 and 8.0 can both drop a column. ..chrisxj
On Fri, Dec 16, 2005 at 06:18:04PM -0800, Neil Drumm wrote:
From the documentation of hook_update_N():
Where is the documentation defined? I can't find it in HEAD source (it was defined in updates.inc but one of patches removed it; maybe should be added back). Needs to be updated.
MySQL: ALTER TABLE {$table} DROP $column Postgres: ALTER TABLE {$table} RENAME $column TO $column_old // For compatibility reasons we don't drop columns but rename them
Why do we do this? What compatibility reasons?
This is not true for 4.7 anymore. We had this previously because we supported PostgreSQL 7.2 which didn't support DROP COLUMN. Since 4.7 we support postgres 7.3+ which supports the statement. -- Piotrek irc: #debian.pl Mors Drosophilis melanogastribus!
Piotr Krukowiecki wrote:
Where is the documentation defined? I can't find it in HEAD source (it was defined in updates.inc but one of patches removed it; maybe should be added back).
In contrib with the rest of the hooks, where it belongs. -- Neil Drumm http://delocalizedham.com/
participants (7)
-
Adrian Rossouw -
Chris Johnson -
Greg Knaddison -
Keegan Quinn -
Neil Drumm -
piotr@mallorn.ii.uj.edu.pl -
Rowan Kerr