I query Postgres with \d
and get a list of tables including table foo
.
Schema | Name | Type | Owner
--------+------+-------+----------
public | foo | table | postgres
I then query \d foo
, and get told: Did not find any relation named "foo".
When I then try DROP TABLE foo
, ERROR: table "foo" does not exist.
Adding the name of the scheme does not change the response.
What could be the cause?
The error came about when using ogr2ogr with and without -overwrite -lco OVERWRITE=YES
, and both combinations, which some say has issues, although I have used the tool for hours a day for months without seeing the problem.
There are very likely hidden or invisible characters in the table name. Provided that foo
is a part of the table name, you can list all such table names with
SELECT oid::regclass
FROM pg_class
WHERE relname LIKE '%foo%';
If there are any spaces or weird characters in the name, it will be output with double quotes, like
"foo "
You can just copy and paste that quoted name into your DROP TABLE
statement.