Обсуждение: how to drop table named user

Поиск
Список
Период
Сортировка

how to drop table named user

От
"Patrick Hatcher"
Дата:
We accidentally created a table called user  in our public schema.  We are
now trying to remove the table using DROP TABLE user and even DROP TABLE
public.user.  However every time we try we get an error message: ERROR:
parser: parse error at or near "user" at character 12

Any suggestion on how to remove this table?  I thought maybe going through
Pg Class, but I'm terrified of mucking something else up.
TIA

Patrick Hatcher



Re: how to drop table named user

От
Doug McNaught
Дата:
"Patrick Hatcher" <PHatcher@macys.com> writes:

> We accidentally created a table called user  in our public schema.  We are
> now trying to remove the table using DROP TABLE user and even DROP TABLE
> public.user.  However every time we try we get an error message: ERROR:
> parser: parse error at or near "user" at character 12
>
> Any suggestion on how to remove this table?  I thought maybe going through
> Pg Class, but I'm terrified of mucking something else up.
> TIA

DROP TABLE "user" should work.  The table name has to be quoted to
distinguish it from the USER SQL keyword.

-Doug

Re: how to drop table named user

От
Дата:
> We accidentally created a table called user  in our public schema.  We
> are now trying to remove the table using DROP TABLE user and even DROP
> TABLE public.user.  However every time we try we get an error message:
> ERROR: parser: parse error at or near "user" at character 12
>
> Any suggestion on how to remove this table?  I thought maybe going
> through Pg Class, but I'm terrified of mucking something else up.

I think maybe you could try enclosing the table name within double
quotation marks.

~Berend Tober