I'm using below code to insert rows into postgresql table. The values are inserted into table. But would like to remove the warning message. Could anyone suggest?
con <- dbConnect(RPostgres::Postgres(), dbname = db, host=host_db, port=db_port, user=db_user, password=db_password)
qry <- sprintf("insert into school (school_name, school_address, user) values(%s, %s, %s);", curSchoolName,curSchoolAddress,loggedIn_user)
rs <- dbSendQuery(con, qry)
print(rs)
<PqResult>
SQL insert into school(school_name, school_address, user) values('school name', 'school address', 'user name');
ROWS Fetched: 0 [complete]
Changed: 1
data frame with 0 columns and 0 rows
Warning messages:
1: In result_create(conn@ptr, statement, immediate) :
Closing open result set, cancelling previous query
2: In result_create(conn@ptr, statement, immediate) :
Closing open result set, cancelling previous query
3: In result_fetch(res@ptr, n = n) :
Don't need to call dbFetch() for statements, only for queries
I tried to use the below code to fetch.. since this is insert rows the fetched is "0" from the print(rs)
data_extract <- dbFetch(rs, n = -1)