drop table not working because illegal characters in name

0

I have created a table in Redshift accidentally putting a period in the name. I intended to create a table called "clusters" in my schema called "client3". However instead of the command

CREATE TABLE client3.clusters

I used the command

CREATE TABLE "client3.clusters"

and now I have a table called "client3.clusters" in my public schema.

If I click on the 3 dots to the right of the table name and choose Drop Table, the query field gets populated with this:

drop table public.client3.clusters;

I get this error message:

ERROR: cross-database reference to database "public" is not supported.

If I try to use quotes, as in

drop table "public.client3.clusters";

I get the error message

ERROR: Table "public.client3.clusters" does not exist

even though I see this table in the list under public.

I would appreciate some advice on how to drop this table. Thanks!

질문됨 3년 전568회 조회
2개 답변
0
수락된 답변

You need to double quote the table name separately:

dev=# CREATE TABLE "client3.clusters" AS SELECT 1;
SELECT
dev=# DROP TABLE "public.client3.clusters";
ERROR:  Table "public.client3.clusters" does not exist
dev=# DROP TABLE public."client3.clusters";
DROP TABLE
답변함 3년 전
profile picture
전문가
검토됨 한 달 전
0

Thank you! Worked perfectly.

답변함 3년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠