R equivalent for postgres nextval()

Solution 1:

One can make use of the id sequences of postgres by using dbGetQuery(con, "select nextval(table)")$nextval.