MaxiWheat
MaxiWheat

Reputation: 6251

How to drop a table in PostgreSQL which includes double quotes in its name

I accidentaly created a table in PostgreSQL which contains, in its name, some double quotes. I used SQL Server 2000 DTS to import data from it to my PostgreSQL server, but while importing, it created the table but with double quotes in it.

Actually the table name when I do

SELECT * FROM pg_tables
is :
public","t_freemailer

So, when I try to drop the table using something like :

DROP TABLE "public"."public","t_freemailer"

I get an error : ERROR: table "public" does not exist

And I did not found a way to escape doubles quotes in identifiers name.

Please help

Upvotes: 3

Views: 2488

Answers (2)

gbn
gbn

Reputation: 432210

2 x double quote = quote...

DROP TABLE "public"."public"",""t_freemailer"

Upvotes: 2

ChssPly76
ChssPly76

Reputation: 100706

Use "double" double quotes to escape:

DROP TABLE "public"."public"",""t_freemailer"

Here's a link to the documentation

Upvotes: 4

Related Questions