tomoakin / RPostgreSQL

Automatically exported from code.google.com/p/rpostgresql
64 stars 20 forks source link

cannot suppress full warining #96

Open gbisschoff opened 6 years ago

gbisschoff commented 6 years ago

suppressWarnings(exp) only suppresses half of the messgage. The part of the warning that is related to the psql error (probably received from the database) cannot be suppressed. E.g

add_user(test_con,"NamE","Email","Password") returns the psql error and an R warning

Error in postgresqlExecStatement(conn, statement, ...) : RS-DBI driver: (could not Retrieve the result : ERROR: relation "users" does not exist LINE 1: INSERT INTO users (name,email,password) values('NamE','Email... ^ )

Warning message: In postgresqlQuickSQL(conn, statement, ...) : Could not create execute: INSERT INTO users (name,email,password) values('NamE','Email','6eb12216e1e7515eda6da7104bccf246') RETURNING user_id;

When suppressing warnings suppressWarnings(add_user(test_con,"NamE","Email","Password")) it still returns the first part:

Error in postgresqlExecStatement(conn, statement, ...) : RS-DBI driver: (could not Retrieve the result : ERROR: relation "users" does not exist LINE 1: INSERT INTO users (name,email,password) values('NamE','Email... ^ )

Add the message returned from postgres to the R warning message rather than in a separate print. (PS it makes my unit test look dirty)