I have the IMDB database in PostgreSQL 16, with the table title_basics
. The table contains several columns, including titleSearchCol
which is of type tsvector
. When I try to get rid of the column using psql with
ALTER TABLE title_basics DROP COLUMN titleSearchCol;
PostgreSQL throws an error
ERROR: column "titlesearchcol" of relation "title_basics" does not exist
I can query the table, add more columns and drop other columns using the same syntax just fine. I have tried the postgres superuser as well, resulting in the same error message.
Querying the table with SELECT *...
shows the column and its contents. \d title_basics
also shows the column.
imdb_base=> \d title_basics
Table "public.title_basics"
Column Type Collation Nullable Default
-----------------------------------------------------------
tconst character varying not null
titletype character varying
primarytitle character varying
originaltitle character varying
isadult boolean
startyear numeric
endyear numeric
runtimeminutes character varying
genres character varying
titleSearchCol tsvector
Indexes:
"title_basics_pk" PRIMARY KEY, btree(tconst)
Referenced by:
TABLE "title_akas" CONSTRAINT "title_akas_title_basics_fk" FOREIGN KEY (titleid) REFERENCES title_basics(tconst) NOT VALID
TABLE "title_crew" CONSTRAINT "title_crew_title_basics_fk" FOREIGN KEY (tconst) REFERENCES title_basics(tconst) NOT VALID
TABLE "title_episode" CONSTRAINT "title_episode_title_basics_fk" FOREIGN KEY (parenttconst) REFERENCES title_basics(tconst) NOT VALID
TABLE "title_principals" CONSTRAINT "title_principals_title_basics_fk" FOREIGN KEY (tconst) REFERENCES title_basics(tconst) NOT VALID
TABLE "title_ratings" CONSTRAINT "title_ratings_title_basics_fk" FOREIGN KEY (tconst) REFERENCES title_basics(tconst) NOT VALID
1 Answer 1
As you can see, there's no column titlesearchcol
, but there are column titleSearchCol
. Someone had created that column with capital letters in name (using quotes), and now it only possible to use that column using quotes, like that:
ALTER TABLE title_basics DROP COLUMN "titleSearchCol";
-
Thank you for your help, but unfortunately this results in a similar error message regardless of using capitalization of S and C, and regardless of using double quotation marks.Fuiba– Fuiba2023年05月04日 11:25:01 +00:00Commented May 4, 2023 at 11:25
-
Very strange because for me that works well, like in this simulation: dbfiddle.uk/6CryM1PzRabban Keyak– Rabban Keyak2023年05月04日 11:38:18 +00:00Commented May 4, 2023 at 11:38
-
Thank you for confirming, it does seem that my table is (somehow) broken. Perhaps I will try to make a copy without the tsvector column.Fuiba– Fuiba2023年05月04日 11:46:07 +00:00Commented May 4, 2023 at 11:46
\d title_basics
?