I am using Seqeulize with Nodejs.
My table name is "Users" and it has a column "userName". I have named the ts vectored column userNameVector. In trying to create the column and set the triggers, I keep getting the error "errorMissingColumn".
Apparently it is telling me that my column "userName" doesn't exist but I triple checked and it does.
The log from the node console is as follows:
Executing (default): ALTER TABLE "Users" ADD COLUMN "userNameVector" TSVECTOR
Executing (default): UPDATE "Users" SET "userNameVector" = to_tsvector('english', userName)
Executing (default): CREATE INDEX userName_search_idx ON "Users" USING gin("userNameVector");
Executing (default): CREATE TRIGGER userName_vector_update BEFORE INSERT OR UPDATE ON "Users" FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger("userNameVector", 'pg_catalog.english', userName)
{ [Error: column "username" does not exist]
severity: 'ERROR',
code: '42703',
position: '62',
file: 'parse_relation.c',
line: '2655',
routine: 'errorMissingColumn',
sql: 'UPDATE "Users" SET "userNameVector" = to_tsvector(\'english\', userName)' }
Looks like another case of misguided CaMeL case names.
Postgres identifiers are lower-cased by default. If you use non-standard names (legal, all lower-case) and double-quote them at creation, you have to double-quote them for the rest of their life. So:
"userName"
instead ofuserName
Related: