Ruby/DBI 0.0.17
Ruby Postgres 0.7.0
Ruby 1.6.7
Postgres 7.2.3


Code:
------>
require 'dbi'

DBI.connect('DBI:Pg:test', 'nobody') do | dbh |

  sql = "insert into file_test (file, size, name, id) VALUES (?, ?, ?, ?)"
  dbh.transaction do |dbh|
    dbh.prepare(sql) do | sth | 
      File.open('kermit.jpg') do |fh|
          sth.execute(DBI::Binary.new(fh.read), File.size('kermit.jpg'), 'kermit.jpg', Time.new.to_i);
      end
    end 
  end
end
<------

That's embedded in a index.rhtml file. kermit.jpg is readable and in
the right directory.

Error (error.log):

[Fri Nov 15 12:37:50 2002] [error] mod_ruby: error in ruby
/usr/local/lib/ruby/site_ruby/1.6/DBD/Pg/Pg.rb:425:in `execute': can't open large object (DBI::ProgrammingError)
        from /usr/local/lib/ruby/site_ruby/1.6/dbi/dbi.rb:734:in `execute'
        from /tmp/index.rhtml.29105.0:10
        from /tmp/index.rhtml.29105.0:9:in `open'
        from /tmp/index.rhtml.29105.0:9
        from /tmp/index.rhtml.29105.0:8:in `prepare'
        from /tmp/index.rhtml.29105.0:8
        from /tmp/index.rhtml.29105.0:7:in `transaction'
        from /tmp/index.rhtml.29105.0:7
        from /tmp/index.rhtml.29105.0:4:in `connect'
        from /usr/local/lib/ruby/site_ruby/1.6/dbi/dbi.rb:367:in `connect'
        from /tmp/index.rhtml.29105.0:4
        from /usr/local/lib/ruby/1.6/apache/eruby-run.rb:112:in `load'
        from /usr/local/lib/ruby/1.6/apache/eruby-run.rb:112:in `run'
        from /usr/local/lib/ruby/1.6/apache/eruby-run.rb:78:in `handler'
        from ruby:0


Any idea where the problem is? It seems the lo_open()-call in the
postgres module returns an error (-1).