pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedCan't drop table (repost)
6+ messages / 2 participants
[nested] [flat]
* Can't drop table (repost)
@ 2001-04-24 15:31 Jeremy Buchmann <jeremy@wellsgaming.com>
0 siblings, 1 reply; 6+ messages in thread
From: Jeremy Buchmann @ 2001-04-24 15:31 UTC (permalink / raw)
To: pgsql-admin
(This is a repost as I haven't received any answers yet :( )
Hi all,
I have a weird situation here...I'm trying to drop a table, but it tells me
that "Relation 'xxxxxxx' inherits 'mytable'". So I renamed mytable to
myoldtable and created a new mytable. Now, the new mytable is missing the
fields I was trying to add, and when I try to drop it, it says "Relation
'xxxxxxx' inherits 'mytable'". And when I try to drop myoldtable, it says
"Relation 'xxxxxxx' inherits 'myoldtable'". How do I get out of this mess?
Also, I noticed some tables named like pg_temp.1970.0 and such. They seem
to contain some junk data from queries or something, but it won't let me
delete them...how can I get rid of them?
I'm using pgsql 6.5.3 on Linux 2.2
Thanks,
-- Jeremy [jeremy@wellsgaming.com]
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Can't drop table (repost)
@ 2001-04-25 16:07 Tom Lane <tgl@sss.pgh.pa.us>
parent: Jeremy Buchmann <jeremy@wellsgaming.com>
0 siblings, 1 reply; 6+ messages in thread
From: Tom Lane @ 2001-04-25 16:07 UTC (permalink / raw)
To: Jeremy Buchmann <jeremy@wellsgaming.com>; +Cc: pgsql-admin
Jeremy Buchmann <jeremy@wellsgaming.com> writes:
> I have a weird situation here...I'm trying to drop a table, but it tells me
> that "Relation 'xxxxxxx' inherits 'mytable'". So I renamed mytable to
> myoldtable and created a new mytable. Now, the new mytable is missing the
> fields I was trying to add, and when I try to drop it, it says "Relation
> 'xxxxxxx' inherits 'mytable'". And when I try to drop myoldtable, it says
> "Relation 'xxxxxxx' inherits 'myoldtable'". How do I get out of this mess?
You can't drop a table that has inheritance children --- you have to
drop the children first. And renaming tables doesn't affect the
inheritance relationships.
> Also, I noticed some tables named like pg_temp.1970.0 and such. They seem
> to contain some junk data from queries or something, but it won't let me
> delete them...how can I get rid of them?
Those are temp tables; if a backend crashed while it had a temp table
created, then you'd see the leftover tables. Offhand I think you won't
be allowed to delete 'em unless you restart the postmaster with the
allow-system-table-mods switch.
> I'm using pgsql 6.5.3 on Linux 2.2
Time to upgrade...
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Can't drop table (repost)
@ 2001-04-25 17:16 Jeremy Buchmann <jeremy@wellsgaming.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 6+ messages in thread
From: Jeremy Buchmann @ 2001-04-25 17:16 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin
> Jeremy Buchmann <jeremy@wellsgaming.com> writes:
>> I have a weird situation here...I'm trying to drop a table, but it tells me
>> that "Relation 'xxxxxxx' inherits 'mytable'". So I renamed mytable to
>> myoldtable and created a new mytable. Now, the new mytable is missing the
>> fields I was trying to add, and when I try to drop it, it says "Relation
>> 'xxxxxxx' inherits 'mytable'". And when I try to drop myoldtable, it says
>> "Relation 'xxxxxxx' inherits 'myoldtable'". How do I get out of this mess?
>
> You can't drop a table that has inheritance children --- you have to
> drop the children first. And renaming tables doesn't affect the
> inheritance relationships.
Okay great, but how do I know what tables I need to drop if it just gives me
a number? That 'xxxxxxx' is just some number like '8892659'. Where is the
mapping from number->name? And do you think this inheritance "feature"
could be mentioned in the user guide?
>> Also, I noticed some tables named like pg_temp.1970.0 and such. They seem
>> to contain some junk data from queries or something, but it won't let me
>> delete them...how can I get rid of them?
>
> Those are temp tables; if a backend crashed while it had a temp table
> created, then you'd see the leftover tables. Offhand I think you won't
> be allowed to delete 'em unless you restart the postmaster with the
> allow-system-table-mods switch.
It is possible that these temp tables could be inherited from the "mytable"
mentioned above...if I removed them with the allow-system-table-mods, would
that fix the pg_inherits table so that mytable could be removed?
--Jeremy
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Can't drop table (repost)
@ 2001-04-25 17:30 Tom Lane <tgl@sss.pgh.pa.us>
parent: Jeremy Buchmann <jeremy@wellsgaming.com>
0 siblings, 1 reply; 6+ messages in thread
From: Tom Lane @ 2001-04-25 17:30 UTC (permalink / raw)
To: Jeremy Buchmann <jeremy@wellsgaming.com>; +Cc: pgsql-admin
Jeremy Buchmann <jeremy@wellsgaming.com> writes:
> Okay great, but how do I know what tables I need to drop if it just gives me
> a number? That 'xxxxxxx' is just some number like '8892659'. Where is the
> mapping from number->name?
select relname from pg_class where oid = '8892659';
More recent versions do provide the relation name instead of number
in that error message, btw.
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Can't drop table (repost)
@ 2001-04-25 17:47 Jeremy Buchmann <jeremy@wellsgaming.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 6+ messages in thread
From: Jeremy Buchmann @ 2001-04-25 17:47 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin
> Jeremy Buchmann <jeremy@wellsgaming.com> writes:
>> Okay great, but how do I know what tables I need to drop if it just gives me
>> a number? That 'xxxxxxx' is just some number like '8892659'. Where is the
>> mapping from number->name?
>
> select relname from pg_class where oid = '8892659';
>
> More recent versions do provide the relation name instead of number
> in that error message, btw.
Okay,
cpcs=> select relname from pg_class where oid = '8892659';
relname
---------------
pg_temp.29453.1
(1 row)
So it is one of those temp tables...now if I delete those tables with the
allow-system-table-mods switch, will that still correct the pg_inherits
table so that the dependency no longer exists? Or can I remove that by
hand, too?
Thanks,
-- Jeremy [jeremy@wellsgaming.com]
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Can't drop table (repost)
@ 2001-04-25 18:02 Tom Lane <tgl@sss.pgh.pa.us>
parent: Jeremy Buchmann <jeremy@wellsgaming.com>
0 siblings, 0 replies; 6+ messages in thread
From: Tom Lane @ 2001-04-25 18:02 UTC (permalink / raw)
To: Jeremy Buchmann <jeremy@wellsgaming.com>; +Cc: pgsql-admin
Jeremy Buchmann <jeremy@wellsgaming.com> writes:
> So it is one of those temp tables...now if I delete those tables with the
> allow-system-table-mods switch, will that still correct the pg_inherits
> table so that the dependency no longer exists?
Yes, you should be okay once you've dropped the leftover temp tables.
BTW, you should consider updating to a newer release in hopes of getting
rid of the bug that's allowing the temp tables to stick around...
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2001-04-25 18:02 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-04-24 15:31 Can't drop table (repost) Jeremy Buchmann <jeremy@wellsgaming.com>
2001-04-25 16:07 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-04-25 17:16 ` Jeremy Buchmann <jeremy@wellsgaming.com>
2001-04-25 17:30 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-04-25 17:47 ` Jeremy Buchmann <jeremy@wellsgaming.com>
2001-04-25 18:02 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox