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
エキスパート
レビュー済み 1ヶ月前
0

Thank you! Worked perfectly.

回答済み 3年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ