0

I'm trying to interact with my PostgreSQL database. I installed the 'pg' gem, and I'd like to execute a very simple script like this one:

require 'pg'
conn = PG::Connection.open('127.0.0.1' , 5432, nil, nil, 'postgres', 'postgres', 'admin')  
res  = conn.exec('SELECT * FROM testtable')

But all I get is:

testdb.rb:4:in `exec': ERROR: relation "testtable" does not exist (PG::UndefinedTable)

If you have any clue or sample code, that would help a lot!

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Roog
  • 1
  • 4

0 Answers0