Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 647132E383B for ; Fri, 7 Dec 2007 14:52:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 44750-04 for ; Fri, 7 Dec 2007 14:51:59 -0400 (AST) Received: from serv01.siteground137.com (ns1.siteground137.com [67.15.250.10]) by postgresql.org (Postfix) with ESMTP id 2248C2E3833 for ; Fri, 7 Dec 2007 14:52:10 -0400 (AST) Received: from cragnux.laika.com ([209.162.219.253]:60874 helo=dogma.ljc.laika.com) by serv01.siteground137.com with esmtpa (Exim 4.68) (envelope-from ) id 1J0iIs-0004qQ-TB for pgsql-interfaces@postgresql.org; Fri, 07 Dec 2007 12:52:04 -0600 Subject: ruby-postgres doesn't compile against 8.3! From: Jeff Davis To: pgsql-interfaces@postgresql.org Content-Type: text/plain Date: Fri, 07 Dec 2007 10:52:00 -0800 Message-Id: <1197053520.28804.122.camel@dogma.ljc.laika.com> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 (2.0.4-7) Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - serv01.siteground137.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - j-davis.com X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/2 X-Sequence-Number: 6667 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 0.7.1.2006.04.06. 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 unmaintained. I am working on my own fork of the project, ruby-pg, where I maintain patches against ruby-postgres. It can be found here: http://rubyforge.org/projects/ruby-pg I backpatched it to stable, so you can check it out here: svn co http://ruby-pg.rubyforge.org/svn/branches/stable 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. Regards, Jeff Davis ------------------------------------------------ PROBLEM DETAILS: The snapshot releases of ruby-postgres do not compile against PostgreSQL 8.3. This is due to a rather strange sequence in postgres.c: #ifndef HAVE_PG_ENCODING_TO_CHAR #define pg_encoding_to_char(x) "SQL_ASCII" #else extern char* pg_encoding_to_char(int); #endif 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" compilation error. 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.