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

> 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\.\.\.\.

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.

Great!

Keep using mkmf for the time being. moving to mkrf will require users
previously have it installed to properly build the gem on every
platform, also dunno it's state regarding cross-platform
functionality.

I'll work on setting up monitoring for it and provide you patches.

Also, I'll build it against 8.2 since 8.3 as not been promoted to
stable.

Will be helpful if you can also provide me a mailing list where the
integration builder will output the building results...

Something like this:
http://rubyforge.org/pipermail/rubyinstaller-devel/2008-April/000263.html
Or this:
http://rubyforge.org/pipermail/rubyinstaller-devel/2008-April/000283.html

Regards,

Thank you for your time, I'll let you know how this end :slight_smile:

Regards,

···

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

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

--
Luis Lavena

I can see Jeff's point. If both libpq and the Postgres JDBC drivers exist what is the value add and writing a third version that duplicates their functionality? Certainly it could be a good research project to see how complexity, bug count, and performance vary across three implementations but not a great use of Jeff's time.

Does anyone know which of the Postgres JDBC driver or libpq is most widely used today and most reliable?

Peter

···

On Apr 16, 2008, at 2:08 PM, Jeff Davis wrote:

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

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

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 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, Joel VanderWerf wrote:

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:

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 Davis

···

On Tue, 2008-04-15 at 15:57 +0900, Chad Perrin 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.

Luis Lavena wrote:

-----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,
--
Luis Lavena

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 Gawlowski <cmdjackr...@googlemail.com> > wrote:

Thomas Kellerer wrote:

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?

Because Ruby doesn't really compare to Java in terms of infrastructure
and APIs?

Both Ruby and the database you want to speak to have to provide an API
to do that (JDBC is a Java API, and still needs the proper connectors to
actually talk to the database, similar to ODBC).

It is not yet possible with Ruby (except via Ruby/DL, I've heard), but
it certainly could be.

So, up to trying to do something like that? :stuck_out_tongue_winking_eye:

At the moment, you have to hook into C somehow, or wrap a C/C++
extension to pull that off. Which is certainly possible, as the various
DB-gems show.

However, since Ruby has no ready-made API for hooking up DB connectors
and all that stuff, the job has be done over and over again, for each DB
Ruby shall support.

And, IMO, adding such an API, while nice, would be beyond Ruby's scope.

And JRuby needs the JDBC libraries of, for example, MySQL to talk to a
MySQL server. Those aren't part of Java's distribution. :expressionless:

But the relative ease of installation makes JRuby very, very attractive
to me when deploying Rails apps.

Well, MySQL might become shipped as a standard, since Sun bought out
MySQL, but you never know..

Long story short: It's not impossible to define a standard API for Ruby,
but somebody has to do it yet (don't look at me, C makes me scream).

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

~ - You know you've been hacking too long when...
...you want to retract something said in haste, and think C-a C-@ C-e C-w

It is certainly possible. It would require a huge amount of effort,
however. Not just up-front effort, but lots of maintenance effort, as
well.

There is also a question of scope. What are the limits to this line of
reasoning? Are we going to re-implement every system library, or just
some of them?

Regards,
  Jeff Davis

···

On Wed, 2008-04-16 at 23:15 +0900, Thomas Kellerer wrote:

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?

Also, I'll build it against 8.2 since 8.3 as not been promoted to
stable.

Promoted to stable by whom? PostgreSQL 8.3.1 is the latest stable
release on all platforms.

Will be helpful if you can also provide me a mailing list where the
integration builder will output the building results...

Something like this:
http://rubyforge.org/pipermail/rubyinstaller-devel/2008-April/000263.html
Or this:
http://rubyforge.org/pipermail/rubyinstaller-devel/2008-April/000283.html

I set up the mailing list ruby-pg-devel.

Regards,
  Jeff Davis

···

On Thu, 2008-04-17 at 03:15 +0900, Luis Lavena wrote:

Having started this huge thread on PostgresSQL, I found...

....after much swearing at the complexities of setting up users and
passwords and permissions in PostgresSQL.... (I don't care, there will
only ever be one user, why am I battling this stuff?! Bugger this for
a bowl of cherries!)

..and now am yet another happy SQLite user.

Soo so so much simpler.

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

Libpq is widely used. I'm not sure what exactly you mean by reliable,
but libpq is solid code.

I don't have any experience with the JDBC driver.

Regards,
  Jeff Davis

···

On Fri, 2008-05-23 at 12:24 +0900, Peter Booth wrote:

Does anyone know which of the Postgres JDBC driver or libpq is most
widely used today and most reliable?

John Carter 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 Gawlowski
Twitter: twitter.com/cynicalryan

[Abstract art is] a product of the untalented, sold by the unprincipled
~ to the utterly bewildered.
~ -- Al Capp

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:31:34AM +0900, Jeff Davis wrote:

On Tue, 2008-04-15 at 15:57 +0900, Chad Perrin 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.

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
Marvin Minsky: "It's just incredible that a trillion-synapse computer could
actually spend Saturday afternoon watching a football game."

M. Edward (Ed) Borasky wrote:

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.

Well ... don't say I didn't try. :slight_smile: I installed PostgreSQL 8.3 and the Rails add-on that comes from a third party. I was not able to get it to function, however. What I know so far is that it is derived from the One-Click Installer version 186-22. However, it installs in C:\pgRails, but all of the "bat" files from the One-Click still are looking for C:\Ruby, and it doesn't put the right path in the PATH environment variable. So the "gem" console, which is usually how I access things from the One-Click Ruby, doesn't work.

The Rails piece of it may be hard coded to actually function, but I couldn't find any documentation on how to start that up, so I didn't get anywhere with it. A couple of months ago I tried it and posted some comments on the creator's forum. They are looking for volunteers. :slight_smile:

By the way, if it matters, the Windows PostgreSQL 8.3 installer loads a copy of the Visual C++ 2005 run time.

Phillip Gawlowski, 16.04.2008 16:39:

Thomas Kellerer wrote:

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

Because Ruby doesn't really compare to Java in terms of infrastructure
and APIs?

Both Ruby and the database you want to speak to have to provide an API
to do that (JDBC is a Java API, and still needs the proper connectors to
actually talk to the database, similar to ODBC).

This is not want I meant. It's the driver that provides the JDBC API to the application. This is true for all 100% Java JDBC drivers. (e.g. the Oracle, SQL Server, MySQL).

All of them have to use the core functions available in the JDK. The JDK itself does not contain any implementation of the JDBC API (apart from the DriverManager maybe), so all those drivers basically use the standard Java IO and network classes to communicate with their backend (and of course their own classes that support the DBMS protocol)

I'm a complete newbie with Ruby, but from what I have seen, I would be very surprised if it wasn't possible to implement a pure Ruby implementation to communicate with a Postgres backend. How much work that would be, is probably another question though.

Thomas

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

Thomas Kellerer wrote:

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

Because Ruby doesn't really compare to Java in terms of infrastructure
and APIs?

While this may be true in some general sense, I don't think its really all that
relevant here. PostgreSQL's protocol is documented and supported over
TCP/IP, and Ruby certainly has TCP/IP support, so there is no reason you
couldn't write a pure Ruby PostgreSQL driver.

Long story short: It's not impossible to define a standard API for Ruby,
but somebody has to do it yet (don't look at me, C makes me scream).

Ruby has a fairly standard DB API: Ruby-DBI. And there's no reason you
need to use C to write Ruby-DBI database drivers.

···

On Wed, Apr 16, 2008 at 7:39 AM, Phillip Gawlowski <cmdjackryan@googlemail.com> wrote:

This is exactly the goal of the DataObjects project. It's a simple,
bare, unified API for Sqlite3, MySQL, and Postgres. ADO.NET and JDBC
bridges are planned as well...

···

On Apr 16, 9:39 am, Phillip Gawlowski <cmdjackr...@googlemail.com> wrote:

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

Thomas Kellerer wrote:

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

Because Ruby doesn't really compare to Java in terms of infrastructure
and APIs?

Both Ruby and the database you want to speak to have to provide an API
to do that (JDBC is a Java API, and still needs the proper connectors to
actually talk to the database, similar to ODBC).

It is not yet possible with Ruby (except via Ruby/DL, I've heard), but
it certainly could be.

So, up to trying to do something like that? :stuck_out_tongue_winking_eye:

At the moment, you have to hook into C somehow, or wrap a C/C++
extension to pull that off. Which is certainly possible, as the various
DB-gems show.

However, since Ruby has no ready-made API for hooking up DB connectors
and all that stuff, the job has be done over and over again, for each DB
Ruby shall support.

And, IMO, adding such an API, while nice, would be beyond Ruby's scope.

And JRuby needs the JDBC libraries of, for example, MySQL to talk to a
MySQL server. Those aren't part of Java's distribution. :expressionless:

But the relative ease of installation makes JRuby very, very attractive
to me when deploying Rails apps.

Well, MySQL might become shipped as a standard, since Sun bought out
MySQL, but you never know..

Long story short: It's not impossible to define a standard API for Ruby,
but somebody has to do it yet (don't look at me, C makes me scream).

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

~ - You know you've been hacking too long when...
..you want to retract something said in haste, and think C-a C-@ C-e C-w
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org

iEYEARECAAYFAkgGD48ACgkQbtAgaoJTgL+OmQCfbLO5l8x0cw+HhH8C6RClJ7VR
SWkAmwX2UxbzdJgNM25SOhEuB+OWDeC1
=4UzI
-----END PGP SIGNATURE-----

Huh? Each RDBMS uses a different wire protocol, and something needs to
speak that wire protocol. If you don't use the C or Java libraries which
the RDBMS provides, it needs to be implemented. Having a "ready-made
API" doesn't avoid having to implement the wire protocol.

Regards,
  Jeff Davis

···

On Wed, 2008-04-16 at 23:39 +0900, Phillip Gawlowski wrote:

However, since Ruby has no ready-made API for hooking up DB connectors
and all that stuff, the job has be done over and over again, for each DB
Ruby shall support.

> Also, I'll build it against 8.2 since 8.3 as not been promoted to
> stable.

Promoted to stable by whom? PostgreSQL 8.3.1 is the latest stable
release on all platforms.

By me? :smiley:

I got several issues from 5.0 to 5.1 when was dealing with MySQL,
also, there is a bigger 8.2 userbase than 8.3 *and* we need to verify
API incompatibilities that those shared libraries (DLL) exposes and
make everything crash.

> Will be helpful if you can also provide me a mailing list where the
> integration builder will output the building results...

> Something like this:
>http://rubyforge.org/pipermail/rubyinstaller-devel/2008-April/000263\.\.\.\.
> Or this:
>http://rubyforge.org/pipermail/rubyinstaller-devel/2008-April/000283\.\.\.\.

I set up the mailing list ruby-pg-devel.

Great, will make the bot subcribe in it and start dumping build
reports :slight_smile:

Regards,

···

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

On Thu, 2008-04-17 at 03:15 +0900, Luis Lavena wrote:

--
Luis Lavena

John Carter wrote:

Having started this huge thread on PostgresSQL, I found...

....after much swearing at the complexities of setting up users and
passwords and permissions in PostgresSQL.... (I don't care, there will
only ever be one user, why am I battling this stuff?! Bugger this for
a bowl of cherries!)

..and now am yet another happy SQLite user.

Soo so so much simpler.

John,

I quite like SQLite actually.. though I'm tempted to go to Postgre mostly for GIS functionality...

Cheers,
Mohit.
5/24/2008 | 12:28 AM.

If the shoe fits. I would use SQLite more if it had proper relational
algebra under its hood.

Todd

···

On Thu, May 22, 2008 at 10:40 PM, John Carter <john.carter@tait.co.nz> wrote:

Having started this huge thread on PostgresSQL, I found...

....after much swearing at the complexities of setting up users and
passwords and permissions in PostgresSQL.... (I don't care, there will
only ever be one user, why am I battling this stuff?! Bugger this for
a bowl of cherries!)

..and now am yet another happy SQLite user.

Soo so so much simpler.