Thread: drop a table from non-public schema

drop a table from non-public schema

From
P Kapat
Date:
How to drop a table which is part of a non-public schema?

drop table myschema.mytable does not work.

--
Regards
PK
--------------------------------------
http://counter.li.org  #402424

Re: drop a table from non-public schema

From
Tom Lane
Date:
P Kapat <kap4lin@gmail.com> writes:
> How to drop a table which is part of a non-public schema?
> drop table myschema.mytable does not work.

Sure it does.  I speculate that you might be running into permissions
or case-folding issues.  What error message are you getting exactly?

            regards, tom lane

Re: drop a table from non-public schema

From
P Kapat
Date:
Thanks for the reply Tom:

On Mon, Apr 6, 2009 at 9:46 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> P Kapat <kap4lin@gmail.com> writes:
>> How to drop a table which is part of a non-public schema?
>> drop table myschema.mytable does not work.
>
> Sure it does.  I speculate that you might be running into permissions
> or case-folding issues.  What error message are you getting exactly?

None. The sequence of cmds are:

$ psql -h remotehost -d myuser -U myuser -W
password:

myuser=# \dt myschema.*
          List of relations
  Schema  |  Name   | Type  | Owner
----------+---------+-------+--------
 myschema | mytable | table | myuser
(1 row)

myuser-# drop table myschema.mytable
myuser-# \dt myschema.*
          List of relations
  Schema  |  Name   | Type  | Owner
----------+---------+-------+--------
 myschema | mytable | table | myuser
(1 row)

myuser-# DROP TABLE myschema.mytable
myuser-# \dt myschema.*
          List of relations
  Schema  |  Name   | Type  | Owner
----------+---------+-------+--------
 myschema | mytable | table | myuser
(1 row)


myschema.mytable has to dependecies, I just created it for test
purpose with one empty column! What am I doing wrong?

--
Regards
PK
--------------------------------------
http://counter.li.org  #402424

Re: drop a table from non-public schema

From
Tom Lane
Date:
P Kapat <kap4lin@gmail.com> writes:
> Thanks for the reply Tom:
> On Mon, Apr 6, 2009 at 9:46 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> P Kapat <kap4lin@gmail.com> writes:
> How to drop a table which is part of a non-public schema?
> drop table myschema.mytable does not work.
>>
>> Sure it does.  I speculate that you might be running into permissions
>> or case-folding issues.  What error message are you getting exactly?

> None. The sequence of cmds are:

> $ psql -h remotehost -d myuser -U myuser -W
> password:

> myuser=# \dt myschema.*
>           List of relations
>   Schema  |  Name   | Type  | Owner
> ----------+---------+-------+--------
>  myschema | mytable | table | myuser
> (1 row)

> myuser-# drop table myschema.mytable
> myuser-# \dt myschema.*
>           List of relations
>   Schema  |  Name   | Type  | Owner
> ----------+---------+-------+--------
>  myschema | mytable | table | myuser
> (1 row)

> myuser-# DROP TABLE myschema.mytable
> myuser-# \dt myschema.*
>           List of relations
>   Schema  |  Name   | Type  | Owner
> ----------+---------+-------+--------
>  myschema | mytable | table | myuser
> (1 row)

You seem to have forgotten to enter a semicolon to terminate the
SQL command ...

            regards, tom lane

Re: drop a table from non-public schema

From
P Kapat
Date:
On Tue, Apr 7, 2009 at 11:16 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> P Kapat <kap4lin@gmail.com> writes:
>> Thanks for the reply Tom:
>> On Mon, Apr 6, 2009 at 9:46 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> P Kapat <kap4lin@gmail.com> writes:
>> How to drop a table which is part of a non-public schema?
>> drop table myschema.mytable does not work.
>>>
>>> Sure it does.  I speculate that you might be running into permissions
>>> or case-folding issues.  What error message are you getting exactly?
>
>> None. The sequence of cmds are:
>
>> $ psql -h remotehost -d myuser -U myuser -W
>> password:
>
>> myuser=# \dt myschema.*
>>           List of relations
>>   Schema  |  Name   | Type  | Owner
>> ----------+---------+-------+--------
>>  myschema | mytable | table | myuser
>> (1 row)
>
>> myuser-# drop table myschema.mytable
>> myuser-# \dt myschema.*
>>           List of relations
>>   Schema  |  Name   | Type  | Owner
>> ----------+---------+-------+--------
>>  myschema | mytable | table | myuser
>> (1 row)
>
>> myuser-# DROP TABLE myschema.mytable
>> myuser-# \dt myschema.*
>>           List of relations
>>   Schema  |  Name   | Type  | Owner
>> ----------+---------+-------+--------
>>  myschema | mytable | table | myuser
>> (1 row)
>
> You seem to have forgotten to enter a semicolon to terminate the
> SQL command ...

Duh, that was trivial! Thanks, Tom.


--
Regards
PK
--------------------------------------
http://counter.li.org  #402424