Error ratio does not exist

I get the error [error: relation "causes" does not exist] from my node application. A connection exists, I'm not sure what the problem is.

I created a 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 a query that gives an 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); }); }); 
+7
postgresql node-postgres
source share
2 answers

This is probably a problem with case folding. See this answer and the PostgreSQL SQL syntax documentation .

After editing . This doesn't seem to be a problem of addition. Check the search_path ( SHOW search_path or SELECT current_setting('search_path') ) and compare it with the schema in which the table is located ( \dt+ tablename ) to make sure the table is in the client path.

Also make sure you connect to the same database.

+1
source share

Just before calling client.query('INSERT...') run the following to make sure your relationship is available for the current connection:

 client.query('SELECT * FROM pg_catalog.pg_tables', function(err, result) { console.log(result); }); 

If you do not see the causes relationship between the results, then either the relationship does not exist or is created by another user.

+1
source share

All Articles