0

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
2
  • Please add to your question what exactly shows \d title_basics? May 4 at 10:09
  • I have added the output to the original question.
    – Fuiba
    May 4 at 10:44

1 Answer 1

0

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";

3
  • 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
    May 4 at 11:25
  • Very strange because for me that works well, like in this simulation: dbfiddle.uk/6CryM1Pz May 4 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
    May 4 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.