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 C. Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : [email protected]
New Zealand

On Tue, 15 Apr 2008, John C. 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

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 C. Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : [email protected]
New Zealand

John C. 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/

On Tue, 15 Apr 2008, Reid T. 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?

John C. Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : [email protected]
New Zealand

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

Ok, sorry, I have now RTFRM “Read The Fine README” and see that ruby-pg is
indeed The O. 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?

On Tue, 15 Apr 2008, John C. wrote:

Or is ruby-pg the One True flavour?
Ok, sorry, I have now RTFRM “Read The Fine README” and see that ruby-pg
is
indeed The O. True Postgres Interface and ruby-postgres is being
superceded

John C. Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : [email protected]
New Zealand

On Tue, 15 Apr 2008, Chad P. wrote:

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

Ok, sorry, I have now RTFRM “Read The Fine README” and see that ruby-pg is
indeed The O. 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.

John C. Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : [email protected]
New Zealand

John C. 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:

On Tue, 15 Apr 2008, Joel VanderWerf wrote:

John C. 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:

Actually, it’s the other way round…

Check the “X-Apparently-From:” header in my mails.

Now you’ll have to excuse me, I must go rescue a scantily clad buxom
maiden in distress from a slobbering alien…

If other readers of this conversation are utterly confused… say
“barsoom” to Google and you will be enlightened…

Well, no, not actually enlightened as such.

Well, at least become informed about an obscure, old fashioned, and
ever so slightly kinky, steam punk corner of literary history.

John C. Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : [email protected]
New Zealand

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

John C. wrote:

| If other readers of this conversation are utterly confused… say
| “barsoom” to Google and you will be enlightened…
|
| Well, no, not actually enlightened as such.

Careful, otherwise Tarzan may beat you to pulp. :stuck_out_tongue_winking_eye:


Phillip G.
Twitter: twitter.com/cynicalryan

[Abstract art is] a product of the untalented, sold by the unprincipled
~ to the utterly bewildered.
~ – Al Capp
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgEQWkACgkQbtAgaoJTgL9CsgCfY1SZcMHZVz31Oy9Yr1peL+Q5
QKsAnj4G7U97WNnScNUU/bTSFFvyk0ZM
=bRxb
-----END PGP SIGNATURE-----

On Tue, Apr 15, 2008 at 01:40:57PM +0900, John C. 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…)

It’s inside the ruby-pg source bundle.

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, 2008-04-15 at 15:57 +0900, Chad P. wrote:

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.

http://ruby-pg.rubyforge.org/svn/ruby-pg/trunk/README

Also, the project description does seem to imply that information in the
255 characters I was allowed for that field.

I haven’t gotten around to actually writing a project home page yet,
which is the only other place I could really put that kind of
information. Rubyforge doesn’t really offer a long description area.

If you have any specific suggestions that can make it more clear, please
let me know.

Regards,
Jeff D.

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

On Tue, 15 Apr 2008, Reid T. 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 D.

On Wed, Apr 16, 2008 at 02:31:34AM +0900, Jeff D. wrote:

I haven’t gotten around to actually writing a project home page yet,
which is the only other place I could really put that kind of
information. Rubyforge doesn’t really offer a long description area.

If you have any specific suggestions that can make it more clear, please
let me know.

Maybe change this:

Ruby-pg provides the module “pg”, a Ruby interface to the PostgreSQL
Relational Database Management System. The ruby-pg project also
maintains a fork of the old “postgres” module from the “ruby-postgres”
project.

. . . into this:

Ruby-pg provides the module “pg”, a Ruby interface to the PostgreSQL
Relational Database Management System, which supersedes “postgres”.
The
ruby-pg project also maintains a fork of the “postgres” module from
the
“ruby-postgres” project.

I get 238 characters for that with wc. There’s enough room left out of
255 to s/which supersedes/meant to supersede/ if you don’t want to speak
for the Ruby community at large in such strong terms, too. I don’t know
if there might be any other concerns that would make you hesitant to
make
this kind of statement, of course.

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

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.

Jeff D. wrote:

Or is ruby-pg the One True flavour?
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 D.

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 Apr 15, 2:43 pm, Jeff D. [email protected] wrote:

Or is ruby-pg the One True flavour?
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.

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,

-----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…

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 G.
Twitter: twitter.com/cynicalryan

~ - You know you’ve been hacking too long when…
…your friends who aren’t hackers wonder what happened to you.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgFQzkACgkQbtAgaoJTgL/vJACeLzxjNj0qVlOKRpaP4w3/bFqI
pRoAn1byheOFdxwwUZN04amf+CrWLtw0
=m1rB
-----END PGP SIGNATURE-----

Luis L. wrote:

| compilers for Windows, Mac, Solaris, etc.

I have to get some C skills under my belt, methinks.
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,

Luis L.

Speaking of Windows and seams, I discovered I have a spare genuine
Windows XP CD-ROM! I had forgotten that I bought it, so I have built a
Windows virtual machine from it snugly nestled inside my Linux
workstation. When I get my current (Linux and Ruby) project finished,
I’m planning to start testing the new One-Click. Meanwhile, I think I’m
going to put up the Windows PostgreSQL/Ruby/Rails thing and see if I can
get it to function in some kind of coherent manner, despite its age.

On Apr 15, 9:08 pm, Phillip G. [email protected]
wrote:

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,