![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
pg_dump -s -n sfrost test -- |
#2
| |||
| |||
|
|
test=> create table a ( test(> b int primary key test(> ); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "a_pkey" for= table "a" CREATE TABLE test=> alter table a rename to c; ALTER TABLE test=> alter index a_pkey rename to c_pkey; ALTER INDEX |
#3
| |||
| |||
|
|
Stephen Frost <sfrost (AT) snowman (DOT) net> writes: test=3D> create table a ( test(> b int primary key test(> ); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "a_pkey"= for=3D table "a" CREATE TABLE test=3D> alter table a rename to c; ALTER TABLE test=3D> alter index a_pkey rename to c_pkey; ALTER INDEX =20 Arguably we should forbid ALTER INDEX RENAME on an index that belongs to a constraint, and make you rename the constraint instead (and have that implicitly change the index name too). |
#4
| |||
| |||
|
|
* Tom Lane (tgl (AT) sss (DOT) pgh.pa.us) wrote: Arguably we should forbid ALTER INDEX RENAME on an index that belongs to a constraint, and make you rename the constraint instead (and have that implicitly change the index name too). That would work too, though I don't think you can just rename a constraint. |
#5
| |||
| |||
|
|
Stephen Frost <sfrost (AT) snowman (DOT) net> writes: * Tom Lane (tgl (AT) sss (DOT) pgh.pa.us) wrote: Arguably we should forbid ALTER INDEX RENAME on an index that belongs to a constraint, and make you rename the constraint instead (and have that implicitly change the index name too). That would work too, though I don't think you can just rename a constraint. Yeah, we'd need to add syntax for that, but it seems useful anyway. Plan B would be to make the ALTER INDEX RENAME update the associated constraint too, but that doesn't give you a facility to rename constraints of other types. Anyway, point is that I think we should force the index and constraint names to track each other, rather than complicating matters by supporting the situation where they are different. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match |
#6
| |||
| |||
|
|
Added to TODO: =20 o Have ALTER INDEX update the name of a constraint using that ind= ex o Allow ALTER TABLE RENAME CONSTRAINT |
|
-------------------------------------------------------------------------= -- =20 Tom Lane wrote: Stephen Frost <sfrost (AT) snowman (DOT) net> writes: * Tom Lane (tgl (AT) sss (DOT) pgh.pa.us) wrote: Arguably we should forbid ALTER INDEX RENAME on an index that belong= s to a constraint, and make you rename the constraint instead (and have t= hat implicitly change the index name too). =20 That would work too, though I don't think you can just rename a constraint. =20 Yeah, we'd need to add syntax for that, but it seems useful anyway. =20 Plan B would be to make the ALTER INDEX RENAME update the associated constraint too, but that doesn't give you a facility to rename constraints of other types. =20 Anyway, point is that I think we should force the index and constraint names to track each other, rather than complicating matters by supporting the situation where they are different. =20 regards, tom lane =20 ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match =20 =20 --=20 Bruce Momjian | http://candle.pha.pa.us pgman (AT) candle (DOT) pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19= 073 |
#7
| |||
| |||
|
|
* Bruce Momjian (pgman (AT) candle (DOT) pha.pa.us) wrote: Added to TODO: o Have ALTER INDEX update the name of a constraint using that index o Allow ALTER TABLE RENAME CONSTRAINT More like: Add ALTER TABLE RENAME CONSTRAINT; implicitly rename linked indexes also Is there much dependency on constraint names? If not, it'd seem like implementing this would be pretty straight-forward. For some reason, I thought there was some dependency on constraint names, but I can't remember what... Thanks, Stephen --------------------------------------------------------------------------- Tom Lane wrote: Stephen Frost <sfrost (AT) snowman (DOT) net> writes: * Tom Lane (tgl (AT) sss (DOT) pgh.pa.us) wrote: Arguably we should forbid ALTER INDEX RENAME on an index that belongs to a constraint, and make you rename the constraint instead (and have that implicitly change the index name too). That would work too, though I don't think you can just rename a constraint. Yeah, we'd need to add syntax for that, but it seems useful anyway. Plan B would be to make the ALTER INDEX RENAME update the associated constraint too, but that doesn't give you a facility to rename constraints of other types. Anyway, point is that I think we should force the index and constraint names to track each other, rather than complicating matters by supporting the situation where they are different. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match -- Bruce Momjian | http://candle.pha.pa.us pgman (AT) candle (DOT) pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 -- End of PGP section, PGP failed! |
![]() |
| Thread Tools | |
| Display Modes | |
| |