table rename oddity
table rename oddity
От:
Ari Jolma <ajolma@water.hut.fi>
Дата:
Hello, Is this kind of behavior intended. When I try to rename a table to a reserved word - I have tried to use 'lseg' which is a type - postgres gives me an error but the change has been partly done and the only way back seems to be to go to the database directory and rename the file. I have tested this with version 7.0. Regards, Ari Jolma An example: template1=> create table a (a int); CREATE template1=> alter table a rename to lseg; ERROR: TypeRename: type lseg already defined template1=> \dt Database = template1 +------------------+----------------------------------+----------+ | Owner | Relation | Type | +------------------+----------------------------------+----------+ | ajolma | a | table | +------------------+----------------------------------+----------+ template1=> select * from a; NOTICE: mdopen: couldn't open a: No such file or directory NOTICE: RelationIdBuildRelation: smgropen(a): No such file or directory NOTICE: mdopen: couldn't open a: No such file or directory NOTICE: mdopen: couldn't open a: No such file or directory NOTICE: mdopen: couldn't open a: No such file or directory NOTICE: mdopen: couldn't open a: No such file or directory ERROR: cannot open relation a template1=> drop table a; NOTICE: mdopen: couldn't open a: No such file or directory NOTICE: mdopen: couldn't open a: No such file or directory DROP template1=> \dt Couldn't find any tables!
Re: table rename oddity
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Ari Jolma writes: > Is this kind of behavior intended. When I try to rename a table to > a reserved word - I have tried to use 'lseg' which is a type - postgres > gives me an error but the change has been partly done and the > only way back seems to be to go to the database directory and > rename the file. I have tested this with version 7.0. Boo hiss --- the physical file rename must be the *last* step in table rename, after all other possible errors have been checked. Evidently it's not :-(. Will fix. regards, tom lane