# Strange problem with rb-postgres

**URL:** <https://www.ruby-forum.com/t/strange-problem-with-rb-postgres/75809>\
**Category:** Ruby\
**Created:** [March 2, 2006, 6:38pm UTC](https://www.ruby-forum.com/t/strange-problem-with-rb-postgres/75809 "2006-03-02T18:38:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ngw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@ngw](https://www.ruby-forum.com/u/ngw)\
**Post date:** [March 2, 2006, 6:38pm UTC](https://www.ruby-forum.com/t/strange-problem-with-rb-postgres/75809/1 "2006-03-02T18:38:54Z")

</div>

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/](http://ruby.scripting.ca/postgres/rdoc/)  
What’s happening here ? Is the documentation outdated ?

ngw

---

<div class="post-metadata">

**Author:** ![ngw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@ngw](https://www.ruby-forum.com/u/ngw)\
**Post date:** [March 3, 2006, 8:32pm UTC](https://www.ruby-forum.com/t/strange-problem-with-rb-postgres/75809/2 "2006-03-03T20:32:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ngw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@ngw](https://www.ruby-forum.com/u/ngw)\
**Post date:** [March 3, 2006, 8:41pm UTC](https://www.ruby-forum.com/t/strange-problem-with-rb-postgres/75809/3 "2006-03-03T20:41:57Z")

</div>

On 3/2/06, ngw [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> This code actually doesn’t work, the method server\_version is undefined, but  
> is documented here: [http://ruby.scripting.ca/postgres/rdoc/](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
