I am getting a [error: relation "causes" does not exist]
error from my node app. The relation does exist, I'm not sure what the problem is.
I created the table with
CREATE TABLE causes (
cause_id bigint NOT NULL default nextval('causes_cause_id_seq'::regclass),
cause_name varchar(40) NOT NULL,
goal integer,
sponsor varchar(30),
organization varchar(30),
submitter varchar(30),
address varchar(34),
balance numeric
);
This is the query that's giving the error:
client = pg.connect(connectionString, function(err, client, done){
if(err) console.log(err);
client.query('INSERT INTO causes (cause_name, goal, organization, sponsor, submitter) VALUES ($1,$2,$3,$4,$5) RETURNING *', r, function(err, result){
if(err) console.log(err);
});
});
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.