Re: Drop table by something other than its name - Mailing list pgsql-novice

From Michael Wood
Subject Re: Drop table by something other than its name
Date
Msg-id 5a8aa6681003171433v411064bambdcc7ac417cb96c7@mail.gmail.com
Whole thread Raw
In response to Re: Drop table by something other than its name  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Drop table by something other than its name  (Felix Obermaier <obe@IVV-AACHEN.DE>)
List pgsql-novice
On 17 March 2010 21:36, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Felix Obermaier <obe@IVV-AACHEN.DE> writes:
>> I have a table with a name that contains some akward letter in it so that pgAdmin fails to display it (just empty)
andpsql omits that character. 
>> My problem is that I cannot query that table and I cannot drop it. Is there a way to get rid of this table?
>
> You probably just need to double-quote the table name.

I think he's having trouble finding out what the table name is in the
first place.

Maybe you can use something like this to get the name:

select relname from pg_catalog.pg_class where relkind = 'r' and
relname like 'some%thing';

where 'some%thing' is the table name with % for the part you don't know.

Using "pg_dump -s" to dump the schema might be another way to find the name.

If that doesn't help, you could perhaps get the table name like the
using a perl/python/whatever program and then in the same program
execute a DROP command using the table name you got previously.

I'd make sure you have a good backup first, though, just in case you
accidentally drop the wrong table.

--
Michael Wood <esiotrot@gmail.com>

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Drop table by something other than its name
Next
From: Gurjeet Singh
Date:
Subject: Re: PostgreSQL questions