Lists: | pgsql-hackers |
---|
From: | Jim Nasby <decibel(at)decibel(dot)org> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | ALTER TABLE RENAME column |
Date: | 2006-11-17 01:29:35 |
Message-ID: | AA3F7C4D-6311-4D5C-97C4-13539BED2EE7@decibel.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Any reason not to support renaming columns? Can this be added to TODO?
Attachment | Content-Type | Size |
---|---|---|
patch | application/octet-stream | 431 bytes |
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jim Nasby <decibel(at)decibel(dot)org> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: ALTER TABLE RENAME column |
Date: | 2006-11-17 06:04:34 |
Message-ID: | 6713.1163743474@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Jim Nasby <decibel(at)decibel(dot)org> writes:
> Any reason not to support renaming columns? Can this be added to TODO?
Uh, we did that years ago.
regards, tom lane
From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Cc: | Jim Nasby <decibel(at)decibel(dot)org> |
Subject: | Re: ALTER TABLE RENAME column |
Date: | 2006-11-17 06:21:05 |
Message-ID: | 200611170721.06686.peter_e@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Jim Nasby wrote:
> Any reason not to support renaming columns? Can this be added to
> TODO?
Upgrade to Postgres95.
--
Peter Eisentraut
http://developer.postgresql.org/~petere/
From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | pgsql-hackers(at)postgresql(dot)org, Jim Nasby <decibel(at)decibel(dot)org> |
Subject: | Re: ALTER TABLE RENAME column |
Date: | 2006-11-17 11:26:05 |
Message-ID: | 455D9C4D.7010503@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Peter Eisentraut wrote:
> Jim Nasby wrote:
>> Any reason not to support renaming columns? Can this be added to
>> TODO?
>
> Upgrade to Postgres95.
Hey, is Jim running MySQL 5?
--
Richard Huxton
Archonet Ltd
From: | "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com> |
---|---|
To: | "Jim Nasby" <decibel(at)decibel(dot)org> |
Cc: | "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: ALTER TABLE RENAME column |
Date: | 2006-11-17 14:47:41 |
Message-ID: | 36e682920611170647v4417fd3cid7ce1ab2eceeef9b@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On 11/16/06, Jim Nasby <decibel(at)decibel(dot)org> wrote:
> Any reason not to support renaming columns? Can this be added to TODO?
ALTER TABLE yo_table RENAME COLUMN yo_column TO yo_new_column;
?
--
Jonah H. Harris, Software Architect | phone: 732.331.1300
EnterpriseDB Corporation | fax: 732.331.1301
33 Wood Ave S, 2nd Floor | jharris(at)enterprisedb(dot)com
Iselin, New Jersey 08830 | http://www.enterprisedb.com/
From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com> |
Cc: | Jim Nasby <decibel(at)decibel(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: ALTER TABLE RENAME column |
Date: | 2006-11-17 14:52:46 |
Message-ID: | 455DCCBE.6030303@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Jonah H. Harris wrote:
> On 11/16/06, Jim Nasby <decibel(at)decibel(dot)org> wrote:
>> Any reason not to support renaming columns? Can this be added to TODO?
>
> ALTER TABLE yo_table RENAME COLUMN yo_column TO yo_new_column;
>
Maybe Jim actually wants a reason to remove support for this ... :-)
cheers
andrew
From: | "Mario Weilguni" <mario(dot)weilguni(at)icomedias(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Jim Nasby" <decibel(at)decibel(dot)org> |
Cc: | "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: ALTER TABLE RENAME column |
Date: | 2006-11-17 14:58:02 |
Message-ID: | FA095C015271B64E99B197937712FD020E4B0EE5@freedom.grz.icomedias.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
> Uh, we did that years ago.
Really?
+ o Add ALTER TABLE RENAME COLUMN (should rename appropriate sequences and constraints)
Sounds like this is not done, at least not renaming sequencens and constraints, or am I wrong here?
Regard
Mario Weilguni
-----Ursprüngliche Nachricht-----
Von: pgsql-hackers-owner(at)postgresql(dot)org [mailto:pgsql-hackers-owner(at)postgresql(dot)org] Im Auftrag von Tom Lane
Gesendet: Freitag, 17. November 2006 07:05
An: Jim Nasby
Cc: PostgreSQL Hackers
Betreff: Re: [HACKERS] ALTER TABLE RENAME column
Jim Nasby <decibel(at)decibel(dot)org> writes:
> Any reason not to support renaming columns? Can this be added to TODO?
Uh, we did that years ago.
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
From: | "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com> |
---|---|
To: | "Mario Weilguni" <mario(dot)weilguni(at)icomedias(dot)com> |
Cc: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Jim Nasby" <decibel(at)decibel(dot)org>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: ALTER TABLE RENAME column |
Date: | 2006-11-17 15:26:41 |
Message-ID: | 36e682920611170726g4ff918ccu23284c2bb754a4b3@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On 11/17/06, Mario Weilguni <mario(dot)weilguni(at)icomedias(dot)com> wrote:
> Sounds like this is not done, at least not renaming sequencens and constraints, or am I wrong here?
To rename a sequence or a table:
ALTER TABLE yo_table RENAME TO yo_new_table;
ALTER TABLE yo_sequence RENAME TO yo_new_sequence;
Or am I mistaken?
--
Jonah H. Harris, Software Architect | phone: 732.331.1300
EnterpriseDB Corporation | fax: 732.331.1301
33 Wood Ave S, 2nd Floor | jharris(at)enterprisedb(dot)com
Iselin, New Jersey 08830 | http://www.enterprisedb.com/
From: | "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com> |
---|---|
To: | "Mario Weilguni" <mario(dot)weilguni(at)icomedias(dot)com> |
Cc: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Jim Nasby" <decibel(at)decibel(dot)org>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: ALTER TABLE RENAME column |
Date: | 2006-11-17 15:27:39 |
Message-ID: | 36e682920611170727g7bf13dfdq4ce712ceb3606b63@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On 11/17/06, Mario Weilguni <mario(dot)weilguni(at)icomedias(dot)com> wrote:
> + o Add ALTER TABLE RENAME COLUMN (should rename appropriate sequences and constraints)
Actually, I don't believe it cascades the rename automagically... if
that's what you're asking.
--
Jonah H. Harris, Software Architect | phone: 732.331.1300
EnterpriseDB Corporation | fax: 732.331.1301
33 Wood Ave S, 2nd Floor | jharris(at)enterprisedb(dot)com
Iselin, New Jersey 08830 | http://www.enterprisedb.com/
From: | "Mario Weilguni" <mario(dot)weilguni(at)icomedias(dot)com> |
---|---|
To: | "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com> |
Cc: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Jim Nasby" <decibel(at)decibel(dot)org>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: ALTER TABLE RENAME column |
Date: | 2006-11-17 15:30:46 |
Message-ID: | FA095C015271B64E99B197937712FD020E4B0EE7@freedom.grz.icomedias.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Right, but I think jim means automatical renames of sequences, and especially something like this:
db=# CREATE TABLE foo (bar serial);
NOTICE: CREATE TABLE will create implicit sequence "foo_bar_seq" for serial column "foo.bar"
CREATE TABLE
db=# ALTER TABLE foo rename bar to baf;
ALTER TABLE
db=# \d foo
Table "public.foo"
Column | Type | Modifiers
--------+---------+---------------------------------------------------
baf | integer | not null default nextval('foo_bar_seq'::regclass)
The sequence still is named "foo_bar_seq".
IMO this should do:
Alter sequence foo_bar_seq rename to foo_baf_seq;
Alter table foo alter baf set default nextval('foo_baf_seq')
-----Ursprüngliche Nachricht-----
Von: Jonah H. Harris [mailto:jonah(dot)harris(at)gmail(dot)com]
Gesendet: Freitag, 17. November 2006 16:27
An: Mario Weilguni
Cc: Tom Lane; Jim Nasby; PostgreSQL Hackers
Betreff: Re: [HACKERS] ALTER TABLE RENAME column
On 11/17/06, Mario Weilguni <mario(dot)weilguni(at)icomedias(dot)com> wrote:
> Sounds like this is not done, at least not renaming sequencens and constraints, or am I wrong here?
To rename a sequence or a table:
ALTER TABLE yo_table RENAME TO yo_new_table; ALTER TABLE yo_sequence RENAME TO yo_new_sequence;
Or am I mistaken?
--
Jonah H. Harris, Software Architect | phone: 732.331.1300
EnterpriseDB Corporation | fax: 732.331.1301
33 Wood Ave S, 2nd Floor | jharris(at)enterprisedb(dot)com
Iselin, New Jersey 08830 | http://www.enterprisedb.com/
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Mario Weilguni" <mario(dot)weilguni(at)icomedias(dot)com> |
Cc: | "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>, "Jim Nasby" <decibel(at)decibel(dot)org>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: ALTER TABLE RENAME column |
Date: | 2006-11-17 15:37:35 |
Message-ID: | 13875.1163777855@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
"Mario Weilguni" <mario(dot)weilguni(at)icomedias(dot)com> writes:
> IMO this should do:
> Alter sequence foo_bar_seq rename to foo_baf_seq;
> Alter table foo alter baf set default nextval('foo_baf_seq')
No, it should not, because that risks breaking other references to the
sequence (eg, in user-written functions). If the user is feeling that
he wants consistency, he can rename the sequence himself and take
responsibility for any side-effects on his code.
regards, tom lane
From: | "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "Mario Weilguni" <mario(dot)weilguni(at)icomedias(dot)com>, "Jim Nasby" <decibel(at)decibel(dot)org>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: ALTER TABLE RENAME column |
Date: | 2006-11-17 15:48:33 |
Message-ID: | 36e682920611170748m4116c876rb1a050a0beea4262@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On 11/17/06, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> No, it should not, because that risks breaking other references to the
> sequence (eg, in user-written functions). If the user is feeling that
> he wants consistency, he can rename the sequence himself and take
> responsibility for any side-effects on his code.
I concur.
--
Jonah H. Harris, Software Architect | phone: 732.331.1300
EnterpriseDB Corporation | fax: 732.331.1301
33 Wood Ave S, 2nd Floor | jharris(at)enterprisedb(dot)com
Iselin, New Jersey 08830 | http://www.enterprisedb.com/
From: | Jim Nasby <decibel(at)decibel(dot)org> |
---|---|
To: | Jonah H(dot) Harris <jonah(dot)harris(at)gmail(dot)com> |
Cc: | "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: ALTER TABLE RENAME column |
Date: | 2006-11-20 22:15:25 |
Message-ID: | 4F2B68DD-3BF6-4769-B55F-538A61B07A94@decibel.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Nov 17, 2006, at 9:47 AM, Jonah H. Harris wrote:
> On 11/16/06, Jim Nasby <decibel(at)decibel(dot)org> wrote:
>> Any reason not to support renaming columns? Can this be added to
>> TODO?
>
> ALTER TABLE yo_table RENAME COLUMN yo_column TO yo_new_column;
Oooops... now I see where it's listed in \h. I knew I must have been
missing something...
--
Jim Nasby jim(at)nasby(dot)net
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)