Error Relation does not exist
Directly before your client.query('INSERT...')
call, run the following to ensure that your relation is accessible on the current connection:
client.query('SELECT * FROM pg_catalog.pg_tables', function(err, result) { console.log(result);});
If you don't see your causes
relation among the results, then either the relation doesn't exist, or it was created under a different user.
This is probably a case folding issue. See this answer and the PostgreSQL documentation on SQL syntax.
After edit: Looks like it isn't a case folding issue. Check search_path
(SHOW search_path
or SELECT current_setting('search_path')
) and compare it to the schema the table is in (\dt+ tablename
) to make sure the table is on the client's path.
Also make sure you're connecting to the same database.
I'm not sure if any of you facing the similar situation like I did.
Please make sure you are using correct user/password to the correct database host.
I found I connected to a wrong database :(