Found the problem. Postgres tends to be case insensitive, but the database name must be in lower case for the RPI, where it does not need to be for windows. I also needed to add the port and host to the DBInterface.connect command. The example is:
Works for Windows
dbread = "Test2"
DATABASE_USER = get(ENV, "LIBPQJL_DATABASE_USER", "postgres")
DATABASE_PASSWORD = Password
conn = DBInterface.connect(FunSQL.DB{LibPQ.Connection},
"dbname=$dbread user=$DATABASE_USER password=$DATABASE_PASSWORD")
Changes for RPI
dbread = "test2"
conn = DBInterface.connect(FunSQL.DB{LibPQ.Connection},
"dbname=$dbread user=$DATABASE_USER password=$DATABASE_PASSWORD
host=localhost port=5432")