Is there a One True Postgres interface? Is Ruby-postgres maintained?

Is there a One true Ruby Interface to Postgres?

All websites I have found so far have "Last Updated" timestamps of
several years ago.

Is ruby-postgres still being maintained?

Running with warnings on,
   require 'postgres'
emits this warning...

/opt/ruby/ruby-1.8.6-p114/lib/ruby/1.8/i686-linux/bigdecimal.so: warning: discarding old open

Looking in the postgres.c file I see...

     rb_define_singleton_alias(rb_cPGconn, "connect", "new");
     rb_define_singleton_alias(rb_cPGconn, "open", "connect");
     rb_define_singleton_alias(rb_cPGconn, "setdb", "connect");
     rb_define_singleton_alias(rb_cPGconn, "setdblogin", "connect");
     rb_define_singleton_alias(rb_cPGconn, "open", "connect");

Deleting the second "open", "connect" gets rid of the warning.

Here's the patch

diff -u postgres.c~ postgres.c
--- postgres.c~ 2005-12-22 04:59:43.000000000 +1300
+++ postgres.c 2008-04-15 10:11:26.000000000 +1200
@@ -2510,7 +2510,6 @@
      rb_define_singleton_alias(rb_cPGconn, "open", "connect");
      rb_define_singleton_alias(rb_cPGconn, "setdb", "connect");
      rb_define_singleton_alias(rb_cPGconn, "setdblogin", "connect");
- rb_define_singleton_alias(rb_cPGconn, "open", "connect");
      rb_define_singleton_method(rb_cPGconn, "escape", pgconn_s_escape, 1);
      rb_define_singleton_method(rb_cPGconn, "quote", pgconn_s_quote, 1);
      rb_define_singleton_alias(rb_cPGconn, "format", "quote");

John Carter Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : john.carter@tait.co.nz
New Zealand

Sorry, some version details on that post...

This is against the snapshot version
    ruby-postgres-20051221.tar.gz

from
   http://ruby.scripting.ca/postgres/

The fault is not in the release version.
     ruby-postgres-0.7.1.tar.gz

John Carter Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : john.carter@tait.co.nz
New Zealand

···

On Tue, 15 Apr 2008, John Carter wrote:

Is ruby-postgres still being maintained?

Running with warnings on,
require 'postgres'
emits this warning...

/opt/ruby/ruby-1.8.6-p114/lib/ruby/1.8/i686-linux/bigdecimal.so: warning: discarding old open

John Carter wrote:

Is there a One true Ruby Interface to Postgres?

All websites I have found so far have "Last Updated" timestamps of
several years ago.

Is ruby-postgres still being maintained?

see ruby-pg

http://rubyforge.org/projects/ruby-pg/

Interestingly enough that link also serves up both flavors,
ruby-postgres and ruby-pg, without comment. Is there any discussion
anywhere on the relative merits?

Or is ruby-pg the One True flavour?

John Carter Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : john.carter@tait.co.nz
New Zealand

···

On Tue, 15 Apr 2008, Reid Thompson wrote:

see ruby-pg

http://rubyforge.org/projects/ruby-pg/

Ok, sorry, I have now RTFRM "Read The Fine README" and see that ruby-pg is
indeed The One True Postgres Interface and ruby-postgres is being superceded

John Carter Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : john.carter@tait.co.nz
New Zealand

···

On Tue, 15 Apr 2008, John Carter wrote:

On Tue, 15 Apr 2008, Reid Thompson wrote:

see ruby-pg

http://rubyforge.org/projects/ruby-pg/

Interestingly enough that link also serves up both flavors,
ruby-postgres and ruby-pg, without comment. Is there any discussion
anywhere on the relative merits?

Or is ruby-pg the One True flavour?

> see ruby-pg
>
> http://rubyforge.org/projects/ruby-pg/

Interestingly enough that link also serves up both flavors,
ruby-postgres and ruby-pg, without comment. Is there any discussion
anywhere on the relative merits?

ruby-postgres had some serious maintenance problems, and was unable to
even build against PostgreSQL 8.3, and my various patches were not
applied.

So, I started maintaining a fork of ruby-postgres with my most important
patches applied, and started a rewrite to address some of the more
fundamental problems. The rewrite is called ruby-pg, and I consider it
to be the best driver available, and it's intended to replace the
others.

Or is ruby-pg the One True flavour?

As far as I can tell, it's the only actively maintained PostgreSQL
driver for Ruby. It's fairly new, but:
* it's well documented (RDoc)
* offers almost all the functionality available from libpq (which is a
lot of functions)
* I'm responsive to bug reports
* I have an expanding set of rspec tests.

The biggest problem I am having with the project is making it work
seamlessly on windows. Several people have tried to help me, but I don't
think the problem has been solved, and I haven't received many specific
suggestions to make it work.

If anyone wants to help me with that, please contact me.

Regards,
  Jeff Davis

···

On Tue, 2008-04-15 at 08:41 +0900, John Carter wrote:

On Tue, 15 Apr 2008, Reid Thompson wrote:

Where'd you find that README? In the source -- or is there somewhere to
get it without downloading?

···

On Tue, Apr 15, 2008 at 08:44:31AM +0900, John Carter wrote:

Ok, sorry, I have now RTFRM "Read The Fine README" and see that ruby-pg is
indeed The One True Postgres Interface and ruby-postgres is being superceded

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
awj @reddit: "The terms never and always are never always true."

>
> > see ruby-pg
> >
> > http://rubyforge.org/projects/ruby-pg/
>
> Interestingly enough that link also serves up both flavors,
> ruby-postgres and ruby-pg, without comment. Is there any discussion
> anywhere on the relative merits?
>

ruby-postgres had some serious maintenance problems, and was unable to
even build against PostgreSQL 8.3, and my various patches were not
applied.

So, I started maintaining a fork of ruby-postgres with my most important
patches applied, and started a rewrite to address some of the more
fundamental problems. The rewrite is called ruby-pg, and I consider it
to be the best driver available, and it's intended to replace the
others.

> Or is ruby-pg the One True flavour?

As far as I can tell, it's the only actively maintained PostgreSQL
driver for Ruby. It's fairly new, but:
* it's well documented (RDoc)

Is there good actual use documentation, rather than only basic class and
method documentation?

* offers almost all the functionality available from libpq (which is a
lot of functions)
* I'm responsive to bug reports
* I have an expanding set of rspec tests.

The biggest problem I am having with the project is making it work
seamlessly on windows. Several people have tried to help me, but I don't
think the problem has been solved, and I haven't received many specific
suggestions to make it work.

That won't prevent me from using it when I start doing some serious
PostgreSQL work with Ruby in the near future -- but I hope you get it
working anyway, of course.

If anyone wants to help me with that, please contact me.

I doubt I'd be much help, but if I think of anything while working with
your module, I'll definitely let you know. There's an outside
possibility I might have to port something to MS Windows at some point, I
guess.

···

On Wed, Apr 16, 2008 at 02:43:20AM +0900, Jeff Davis wrote:

On Tue, 2008-04-15 at 08:41 +0900, John Carter wrote:
> On Tue, 15 Apr 2008, Reid Thompson wrote:

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
Isaac Asimov: "Part of the inhumanity of the computer is that, once it is
completely programmed and working smoothly, it is completely honest."

Jeff Davis wrote:

see ruby-pg

http://rubyforge.org/projects/ruby-pg/

Interestingly enough that link also serves up both flavors,
ruby-postgres and ruby-pg, without comment. Is there any discussion
anywhere on the relative merits?

ruby-postgres had some serious maintenance problems, and was unable to
even build against PostgreSQL 8.3, and my various patches were not
applied.

So, I started maintaining a fork of ruby-postgres with my most important
patches applied, and started a rewrite to address some of the more
fundamental problems. The rewrite is called ruby-pg, and I consider it
to be the best driver available, and it's intended to replace the
others.

Or is ruby-pg the One True flavour?

As far as I can tell, it's the only actively maintained PostgreSQL
driver for Ruby. It's fairly new, but:
* it's well documented (RDoc)
* offers almost all the functionality available from libpq (which is a
lot of functions)
* I'm responsive to bug reports
* I have an expanding set of rspec tests.

The biggest problem I am having with the project is making it work
seamlessly on windows. Several people have tried to help me, but I don't
think the problem has been solved, and I haven't received many specific
suggestions to make it work.

If anyone wants to help me with that, please contact me.

Regards,
  Jeff Davis

Nothing else works seamlessly on Windows. :slight_smile: But seriously, there is an add-on you can get when you install PostgreSQL 8.3 on Windows that contains an ancient implementation of Ruby and Rails -- with PostgreSQL, of course. I looked at it briefly, and I have no idea how it was talking to PostgreSQL.

At this stage of the game, I think a pure Ruby PostgreSQL (and MySQL) interface has some serious advantages over struggling with numerous C compilers for Windows, Mac, Solaris, etc.

···

On Tue, 2008-04-15 at 08:41 +0900, John Carter wrote:

On Tue, 15 Apr 2008, Reid Thompson wrote:

Jeff, I managed to get do_postgres (DataObject.rb project) working on
Windows with PostgreSQL 8.2.

Why you don't fill a Integration Request [1] at RubyInstaller tracker
and point with the instructions to get the code, the dependencies and
everything.

I'll be happy to provide patches to make it work properly under
Windows (both VC6 and MinGW). See my post on PostgreSQL [2]

[1] http://rubyforge.org/tracker/?atid=22895&group_id=167&func=browse
[2] http://rubyforge.org/pipermail/rubyinstaller-devel/2008-April/000284.html

Take care,

···

On Apr 15, 2:43 pm, Jeff Davis <r...@j-davis.com> wrote:

On Tue, 2008-04-15 at 08:41 +0900, John Carter wrote:
> On Tue, 15 Apr 2008, Reid Thompson wrote:

> > see ruby-pg

> >http://rubyforge.org/projects/ruby-pg/

> Interestingly enough that link also serves up both flavors,
> ruby-postgres and ruby-pg, without comment. Is there any discussion
> anywhere on the relative merits?

ruby-postgres had some serious maintenance problems, and was unable to
even build against PostgreSQL 8.3, and my various patches were not
applied.

So, I started maintaining a fork of ruby-postgres with my most important
patches applied, and started a rewrite to address some of the more
fundamental problems. The rewrite is called ruby-pg, and I consider it
to be the best driver available, and it's intended to replace the
others.

> Or is ruby-pg the One True flavour?

As far as I can tell, it's the only actively maintained PostgreSQL
driver for Ruby. It's fairly new, but:
* it's well documented (RDoc)
* offers almost all the functionality available from libpq (which is a
lot of functions)
* I'm responsive to bug reports
* I have an expanding set of rspec tests.

The biggest problem I am having with the project is making it work
seamlessly on windows. Several people have tried to help me, but I don't
think the problem has been solved, and I haven't received many specific
suggestions to make it work.

If anyone wants to help me with that, please contact me.

--
Luis Lavena

In the basement, in the locked cupboard, the one with the sign "Beware
of the Leopard".... :-)) (As you can tell, I'm a Douglas Adams fan...)

It's inside the ruby-pg source bundle.

John Carter Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : john.carter@tait.co.nz
New Zealand

···

On Tue, 15 Apr 2008, Chad Perrin wrote:

On Tue, Apr 15, 2008 at 08:44:31AM +0900, John Carter wrote:

Ok, sorry, I have now RTFRM "Read The Fine README" and see that ruby-pg is
indeed The One True Postgres Interface and ruby-postgres is being superceded

Where'd you find that README? In the source -- or is there somewhere to
get it without downloading?

M. Edward (Ed) Borasky wrote:

At this stage of the game, I think a pure Ruby PostgreSQL (and MySQL)
interface has some serious advantages over struggling with numerous C
compilers for Windows, Mac, Solaris, etc.

No kidding. Looking at the ruby-installer ML, most of the difficulties
are with Ruby's *external* dependencies (readlines in particular).

And these issues cascade, for example, into PostgreSQL (some OpenSSL
dependency weirdness, I take it from Luis) in conjunction with Ruby.

Unfortunately, I don't know how one should implement pure Ruby
implementations since PostgreSQL and others would need to provide a Ruby
interface (at least, as far as I can see). Ah, the joy of interop..

On one level it sounds fun, on the actual implementation levels, I'm
getting greys hairs just looking at the matter.

Sadly, when it comes to C, I'm an end-user of provided binaries, as C
makes my head hurt just by reading C, so I can't be of much help to
Luis' efforts. :frowning:

I have to get some C skills under my belt, methinks.

However, the OCI is making progress in switching away from VC6.0, though
progress is slow.

- --
Phillip Gawlowski
Twitter: twitter.com/cynicalryan

~ - You know you've been hacking too long when...
...your friends who aren't hackers wonder what happened to you.

This may have already been mentioned, but there's postgres-pr:

···

On Wed, 2008-04-16 at 08:49 +0900, M. Edward (Ed) Borasky wrote:

At this stage of the game, I think a pure Ruby PostgreSQL (and MySQL)
interface has some serious advantages over struggling with numerous C
compilers for Windows, Mac, Solaris, etc.

======================
$ gem list -d --remote postgres-pr

*** REMOTE GEMS ***

postgres-pr (0.4.0)
    A pure Ruby interface to the PostgreSQL (&gt;= 7.4) database

Yours,

tom

Thank you for the response!

I have filed an integration request, please let me know if more
information is required.

I would welcome any patches that improve portability to any platform.

Regards,
  Jeff Davis

···

On Wed, 2008-04-16 at 09:20 +0900, Luis Lavena wrote:

Jeff, I managed to get do_postgres (DataObject.rb project) working on
Windows with PostgreSQL 8.2.

Why you don't fill a Integration Request [1] at RubyInstaller tracker
and point with the instructions to get the code, the dependencies and
everything.

I'll be happy to provide patches to make it work properly under
Windows (both VC6 and MinGW). See my post on PostgreSQL [2]

[1] http://rubyforge.org/tracker/?atid=22895&group_id=167&func=browse
[2] http://rubyforge.org/pipermail/rubyinstaller-devel/2008-April/000284.html

Nothing else works seamlessly on Windows. :slight_smile: But seriously, there is an
add-on you can get when you install PostgreSQL 8.3 on Windows that
contains an ancient implementation of Ruby and Rails -- with PostgreSQL,
of course. I looked at it briefly, and I have no idea how it was talking
to PostgreSQL.

Interesting.

At this stage of the game, I think a pure Ruby PostgreSQL (and MySQL)
interface has some serious advantages over struggling with numerous C
compilers for Windows, Mac, Solaris, etc.

In my experience with ruby-pg, there were only minor issues with
platforms other than windows. I solved all the problems that I know
about on OS X, linux, solaris, and freebsd. It probably works on some
other platforms as well. Windows is the only difficult case, as far as I
can tell.

Trying to maintain all the code to implement the PostgreSQL protocol
would be a huge project, and not one that I have the time for.
Furthermore, people need to trust their database driver, and I can
provide a certain level of that trust by using the well-tested libpq
rather than trying to implement it myself.

Regards,
  Jeff Davis

···

On Wed, 2008-04-16 at 08:49 +0900, M. Edward (Ed) Borasky wrote:

I consider the class and method documentation to be quite complete and
useful. Most users can browse that to find the functionality they are
looking for.

There could be some better tutorial documentation, but I haven't gotten
around to that yet.

Regards,
  Jeff Davis

···

On Wed, 2008-04-16 at 07:22 +0900, Chad Perrin wrote:

> As far as I can tell, it's the only actively maintained PostgreSQL
> driver for Ruby. It's fairly new, but:
> * it's well documented (RDoc)

Is there good actual use documentation, rather than only basic class and
method documentation?

John Carter wrote:

In the basement, in the locked cupboard, the one with the sign "Beware
of the Leopard".... :-)) (As you can tell, I'm a Douglas Adams fan...)

Funny. I always figured you as an Edgar Rice Burroughs fan. :wink:

···

--
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

It seems kind of suboptimal, to me, to only let someone know that
postgres has been superseded by pg *after* something has already been
downloaded and unpacked.

···

On Tue, Apr 15, 2008 at 01:40:57PM +0900, John Carter wrote:

On Tue, 15 Apr 2008, Chad Perrin wrote:

>On Tue, Apr 15, 2008 at 08:44:31AM +0900, John Carter wrote:
>>
>>Ok, sorry, I have now RTFRM "Read The Fine README" and see that ruby-pg is
>>indeed The One True Postgres Interface and ruby-postgres is being
>>superceded
>
>Where'd you find that README? In the source -- or is there somewhere to
>get it without downloading?

In the basement, in the locked cupboard, the one with the sign "Beware
of the Leopard".... :-)) (As you can tell, I'm a Douglas Adams fan...)

It's inside the ruby-pg source bundle.

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
Baltasar Gracian: "A wise man gets more from his enemies than a fool from
his friends."

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

M. Edward (Ed) Borasky wrote:

>
> At this stage of the game, I think a pure Ruby PostgreSQL (and MySQL)
> interface has some serious advantages over struggling with numerous C
> compilers for Windows, Mac, Solaris, etc.

No kidding. Looking at the ruby-installer ML, most of the difficulties
are with Ruby's *external* dependencies (readlines in particular).

And these issues cascade, for example, into PostgreSQL (some OpenSSL
dependency weirdness, I take it from Luis) in conjunction with Ruby.

Unfortunately, I don't know how one should implement pure Ruby
implementations since PostgreSQL and others would need to provide a Ruby
interface (at least, as far as I can see). Ah, the joy of interop..

A pure ruby implementation involves:

Usage of Ruby/DL, which is a bridge between C API from DLL and Ruby
and lot of understanding of the internals of the adapter API.

Last time I used Ruby/DL was a nightmare since sometimes what
developers states they export quite differ from reality, so you ended
diggin into the utility source code to catch the expected result in
your side.

Lot of works, and still will be slower than a C ruby extension acting
as bridge between the DLL and your Ruby code.

Sadly, when it comes to C, I'm an end-user of provided binaries, as C
makes my head hurt just by reading C, so I can't be of much help to
Luis' efforts. :frowning:

Don't worry, I take a lot of painkillers after staring a C function
for a long period of time...

I have to get some C skills under my belt, methinks.

However, the OCI is making progress in switching away from VC6.0, though
progress is slow.

I commented to Jeff he should ask for a Integration requrest and I can
help him get the adapter working on both implementations for the time
being.

Anyway, I'll love to know if Ruby on Rails will support this adapter
or not, since all the work will be useless if all the Railers came and
yell about their PostgreSQL database don't work for them :stuck_out_tongue:

Regards,

···

On Apr 15, 9:08 pm, Phillip Gawlowski <cmdjackr...@googlemail.com> wrote:
--
Luis Lavena

Phillip Gawlowski, 16.04.2008 02:08:

Unfortunately, I don't know how one should implement pure Ruby
implementations since PostgreSQL and others would need to provide a Ruby
interface (at least, as far as I can see).

The Postgres JDBC driver is 100% Java and definitely does not rely on any external DLLs or libraries, it speaks the native PG protocol (AFAIK there is no such thing as a "Java interface"). So why shouldn't this be possible with Ruby as well?

Thomas