Forum: Ruby Strange problem with rb-postgres

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
94846d7255b19629c0c78700d9b5a046?d=identicon&s=25 ngw (Guest)
on 2006-03-02 18:38
(Received via mailing list)
Hi *,
I'm using rb-postgres:

require 'postgres'

begin
  dbh = PGconn.new("127.0.0.1", 5432, "", "", "test", "usertest",
"passwdtest")
  puts dbh.server_version
  dbh.close
rescue PGError => e
  puts e.message
end

This code actually doesn't work, the method server_version is undefined,
but
is documented here: http://ruby.scripting.ca/postgres/rdoc/
What's happening here ? Is the documentation outdated ?

  ngw
B7cad399c3a8c73bc2ed4955a8ee2ed1?d=identicon&s=25 Mark Probert (Guest)
on 2006-03-03 20:32
(Received via mailing list)
ngw wrote:
> Hi *,
> I'm using rb-postgres:
>
> require 'postgres'
>
I think this is the C extension, right?  I have the version last updated

   $Author: noboru $
   $Date: 2003/01/06 01:38:20 $

 > This code actually doesn't work, the method server_version
 > is undefined,

Yup.

> begin
>   dbh = PGconn.new("127.0.0.1", 5432, "", "", "test", "usertest",
> "passwdtest")
>   puts dbh.server_version

Instead, you can:

     puts conn.exec("show server_version").result

Hope this helps

--

-mark.
1004b266da7d0e375ed7cb88b6a79e7c?d=identicon&s=25 Dave Lee (Guest)
on 2006-03-03 20:41
(Received via mailing list)
On 3/2/06, ngw <nicholas_wieland@noyahoospam.it> wrote:
> This code actually doesn't work, the method server_version is undefined, but
> is documented here: http://ruby.scripting.ca/postgres/rdoc/
> What's happening here ? Is the documentation outdated ?

I'll update the link and the rdocs to show that the published rdocs
are for the most recent snapshot release.  The #server_version method
is new to the snapshot releases, and is not available in 0.7.1.

Dave
This topic is locked and can not be replied to.