I'm trying to create a schema and add tables to it via node using node-postgres (pg). The basic order of events is as follows:
1. Create schema
2. Create table in schema
3. Create columns in table in schema
I can verify that the schema and the table are being created without issues, but I get a relation does not exist error when trying to add the first column to the table. The query string for creating the column looks like this:
"ALTER TABLE " +
schemaName +
".process ADD COLUMN process_id bigint NOT NULL DEFAULT nextval('" +
schemaName +
".process_process_id_seq'::regclass)";
I've confirmed in the console log that the schema name variable matches what is was used to successfully create the table. Any ideas on why the error is being thrown here?
process_process_id_seqexist?schemaNamethat contains a double quote. Then your query will go boom or worse.