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
asked May 4, 2023 at 9:07
2
  • Please add to your question what exactly shows \d title_basics? Commented May 4, 2023 at 10:09
  • I have added the output to the original question. Commented May 4, 2023 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";

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

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.