|From:||Jeff Davis <pgsql(at)j-davis(dot)com>|
|Subject:||ruby-postgres doesn't compile against 8.3!|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
ruby-postgres is the most widely used PostgreSQL binding for ruby, but
it is unmaintained.
ruby-postgres-0.7.1.tar.gz compiles fine
ruby-postgres-20051221.tar.gz doesn't build
ruby-postgres-20060405.tar.gz doesn't build
ruby-postgres-20060406.tar.gz doesn't build
The same problems exist for the gems, versions 0.7.1.2006.04.05
This could mean that a lot (probably most) of ruby developers will have
a problem upgrading to PostgreSQL 8.3.
This is easy to fix (described below) but unfortunately ruby-postgres is
I am working on my own fork of the project, ruby-pg, where I maintain
patches against ruby-postgres. It can be found here:
I backpatched it to stable, so you can check it out here:
and I also released it as a file in the project.
The stable branch is very similar to snapshot 20060406 with a few
updates of my own. It *should* work fine with applications that work
with that snapshot release.
Most of my work on the project has gone into a branch called raw_libpq
(not currently stable), in which I'm rewriting a lot of the code. I'm
trying to streamline the module and make it a fairly thin wrapper around
libpq, that exposes *all* libpq functionality, with a ruby feel to it.
For instance, I raise exceptions on errors, but those exception objects
also hold the PGconn and PGresult objects so that you can access
detailed information if needed.
I would like this new branch to eventually replace the current ruby-
postgres, which does a lot of type conversion magic in C, which ends up
hiding libpq functionality and complicating the C code. Any type
conversion magic should really be done in ruby; there's no reason to do
it in C. I think that's a big part of the reason the current ruby-
postgres is so cluttered.
So, use ruby-pg instead. But please test it first, it hasn't received
much attention outside of my environment.
The snapshot releases of ruby-postgres do not compile against PostgreSQL
This is due to a rather strange sequence in postgres.c:
#define pg_encoding_to_char(x) "SQL_ASCII"
extern char* pg_encoding_to_char(int);
Apparently, PostgreSQL 8.2 and below did export a function called
pg_encoding_to_char, but did not declare it in any header. PostgreSQL
8.3 does declare it in the header, leading to a "conflicting types"
The quick fix I applied simply removes the declaration (the #else
clause) from postgres.c (which has been renamed to pg.c in my fork).
This leads to an "implicit declaration" compiler warning in 8.2 and
before, but no errors or warnings compiling against 8.3.
|Next Message||jing han||2007-12-11 20:13:47||If postgres database files are corrupted by power failure, how to check which files are corrupted,|
|Previous Message||Adam Radłowski||2007-12-06 21:02:49||Re: libpq crashing under Vista|