[ANN] postgres-pr (pure Ruby PostgreSQL)

Michael,

Very sweet! I'm playing with it and I've hit a few points of
incompatibility so far.

First up, AR will allow you to leave out the host for the postgresql adapter,
which effectively tells the postgres module to use the unix socket. Your
library seems to require it to be set to /dir for the directory the socket file
resides in. I rather prefer your method, but any existing Rails apps would
have to change.

Next, AR is expecting that PGResult have . Mapping this to
@rows.res seems to fix the problem.

Next, your library doesn't seem to like integers that are quoted (eg
UPDATE foo set bar='' where id='1') and this makes a number of AR's
unit tests fail.

Finally, I haven't tracked down this problem just yet, but the AR unit
tests give a good deal of errors very similar to this one:

test_create(BasicsTest):
NoMethodError: undefined method `title=' for #<Topic:0x1027888
@attributes={}, @new_record=true>
    ./test/../lib/active_record/base.rb:817:in `method_missing'
    ./test/base_test.rb:108:in `test_create'

Where it is always failing on a method foo= for an AR class.

Using my own project, postgres-pr works out of the box, but the real
test seems to be making the AR unit tests pass. I'm really glad you
started this project, a gemmed, pure ruby postgres adapter will make
my life easier in a number of ways. Thanks!

-Scott

···

On Fri, 19 Nov 2004 03:04:35 +0900, Michael Neumann <mneumann@ntecs.de> wrote:

Michael Neumann wrote:

it's now available as postgres-pr version 0.1.0. If you've installed
this and ActiveRecord, it should work out-of-the-box.

Regards,

   Michael

P.s. I like both methods. One thing that RPA has that Gems doesn't is the
ability to list (with a single line summary) all of the packages available
for download and install through RPA. While I understand that there's a lot
of methology differences between the two camps, from a user perspective both
seem to accomplish the same thing and do so very well.

???
try: gem list -r

I think a new recall is in order :slight_smile: RPA and the Gems crew has a
fairly good relationship; especially after RubyGems committed to
fixing the main thing that has been seriously bothering the RPA team:
That RubyGems is hard to repackage, and this has been gnawing on our
relationship. With the RubyGems commitment, we're all much more
relaxed, and the RPA/RubyGems relationship is quite good :slight_smile:

Eivind.

···

On Mon, 22 Nov 2004 14:35:35 +0900, Abraham Vionas <abe_ml@bozemantechmedic.com> wrote:

OH NO, you realize you're opening the proverbial can of worms, right? Last
time (if I recall correctly) things ended up with Gems vs. RPA'ers and at
each others throats.

--
Hazzle free packages for Ruby?
RPA is available from http://www.rubyarchive.org/

> Ruby library writers, which one do you prefer or do you find easier to
> package your software with?

In general, they should package using RubyGems or Aoki's setup.rb.
RPA packages are created by the RPA crew: the upstream developer needs
not do anything.

I'd like to pipe up here: I'm often around (#RPA on freenode) to talk
about packaging issue and production issues. Part of the idea is that
it takes some outside involvement to make a good package, to make sure
that things don't collide when loaded at the same time, making install
(and uninstall!) is 100% flawless; making sure that there's nothing
brittle that's likely to break by accident in the distribution.

It takes a lot to make a package production-quality (And I mean the
sort of production like, say, a bank might want for doing transaction
processing; known reliable software that has been tested as well as
checked over for accuracy). Library authors get about 90% of it
themselves, sometimes more. Then there's the things that only happen
when, you say, try to install a new package on ruby 1.6 on an HP/UX
machine, or say, fail to work reliably due to NFS locking issues;
those things take community testing to find.

RPA shies away from having people package their own work, because to
make a coherent system, a human double-check is really nice. In
non-trivial systems, issues come up. If we find some, we'll work with
the author on it. The idea is to get packages up to production quality
for the archive -- since maintenance is an issue, it implies that
getting the author to fix the problem or at least merge a fix into
their own source is the best way. If that's not possible, then the
package gets patched as it's committed to RPA.

The real goal, though, is to make ruby packages in general reliable.
rpa-base, the package manager, is just one way to accomodate that.

Software direct from author to user is great for the bleeding edge.
The early adopter crowd is willing (and in fact enjoys) the challenge
of working with the shifting sands of software. Other businesses won't
commit to something until it's been tested by others, until there's
some guarantee that they can rely on it without it changing beneath
them, that bugs will be fixed without being tied to incompatible API
changes, and that new features will be added on a strictly
won't-break-anything basis. There's room and a need for both in this
world.

Abraham Vionas wrote:

Thanks for the response Michael!

I looked into the topics you suggested and I think I made some progress...
at least now I can see attempts to connect to the db in the
postgresql log.
However, it says that my user names don't exist, when I know they exist
because I can see them from psql - and from PGAdmin III. Any ideas?

My entry in the database.yml is:

production:
  adapter: postgresql
  database: todo
  host: localhost
  port: 5432
  username: root

Errors in Postgresql log:

2004-11-29 19:49:02 FATAL: user "abrahamvionas_sr " does not exist
2004-11-29 19:57:59 FATAL: user "root " does not exist
2004-11-29 19:58:11 FATAL: user "root " does not exist

From the text above it looks lik you've got a tab character at the end of
your username. Perhaps root<tab> is being sent to the database, keeping the
username from matching. Try deleting this extraneous tab character and see
if that helps.

Curt

···

-----Original Message-----
From: Michael Neumann [mailto:mneumann@ntecs.de]
Sent: Monday, November 29, 2004 5:14 PM
To: ruby-talk ML
Subject: Re: [ANN] postgres-pr (pure Ruby PostgreSQL)

Abraham Vionas wrote:
> Michael;
>
> Does this mean there is a new Postgres-PR release available for
> download/update?

You already have the newest version (0.2.2).

> Also, I think the problems I'm having with a tutorial I'm
working through
> are related to Activerecord not communicating through PostgresPR...

No, it communicates through PostgresPR, I'm sure!

> It looks like it goes to it's connection_modules directory looking for a
valid
> postgres connector and the default postgres connector included with
> Activerecord doesn't work for some reason. The precise error is below...
but
> I'm curious how I can ensure (what settings to check, file
locations, etc)
> that Activerecord can communicate to and through PostgresPR...?

You don't have to setup anything.

> RuntimeError in Todo#index
>
> authentification failed

The problem is with authentification. You have either specified a wrong
user/password combination for Postgres, or it's an authentification
method that postgres-pr is not-yet capable of. Can you setup your
Postgres-database to either use password-less or plain-text password
authentification?

Regards,

   Michael

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.799 / Virus Database: 543 - Release Date: 11/19/2004

Let me add my thanks, too. I can see this library getting lots of heavy
usage for my Ruby scripts for admin'ing RubyForge; currently I'm doing
things like exec'ing "psql -c" :slight_smile:

Thanks,

Tom

···

On Thu, 2004-11-18 at 13:47, Scott Barron wrote:

I'm really glad you
started this project, a gemmed, pure ruby postgres adapter will make
my life easier in a number of ways. Thanks!

Scott Barron wrote:

Michael Neumann wrote:

it's now available as postgres-pr version 0.1.0. If you've installed
this and ActiveRecord, it should work out-of-the-box.

Regards,

  Michael

Michael,

Very sweet! I'm playing with it and I've hit a few points of
incompatibility so far.

First up, AR will allow you to leave out the host for the postgresql adapter, which effectively tells the postgres module to use the unix socket. Your library seems to require it to be set to /dir for the directory the socket file resides in. I rather prefer your method, but any existing Rails apps would have to change.

fixed!

Next, AR is expecting that PGResult have . Mapping this to
@rows.res seems to fix the problem.

fixed!

Next, your library doesn't seem to like integers that are quoted (eg
UPDATE foo set bar='' where id='1') and this makes a number of AR's
unit tests fail.

fixed!

Finally, I haven't tracked down this problem just yet, but the AR unit
tests give a good deal of errors very similar to this one:

test_create(BasicsTest):
NoMethodError: undefined method `title=' for #<Topic:0x1027888
@attributes={}, @new_record=true>
    ./test/../lib/active_record/base.rb:817:in `method_missing'
    ./test/base_test.rb:108:in `test_create'

Where it is always failing on a method foo= for an AR class.

I've run the test cases. of the 717 assertions, I get only 10 errors, but they seem to be not postgres-pr specific. I've appended the output of the test-cases at this email. Maybe someone can take a look at it.

I've released 0.1.1 which fixes all those bugs (except the remaining 10). Update the gem and run the test-cases.

Regards,

   Michael

postgres-pr-tests (5.1 KB)

···

On Fri, 19 Nov 2004 03:04:35 +0900, Michael Neumann <mneumann@ntecs.de> wrote:

Don't look for differences at the UI level, they are irrelevant anyway:
both RubyGems and rpa-base will have better interfaces in the future.
Other features might or might not be important, depending on your needs
(they were required for RPA's goals).

BTW, they are not two [opposing] camps. The RubyGems team have stated
they are going to make the repackaging (and incidentally RPA's) task
easier, and 1/5th of RubyGems' code comes straight from rpa-base.

···

On Mon, Nov 22, 2004 at 06:32:33PM +0900, Tobias Luetke wrote:

> P.s. I like both methods. One thing that RPA has that Gems doesn't is the
> ability to list (with a single line summary) all of the packages available
> for download and install through RPA. While I understand that there's a lot
> of methology differences between the two camps, from a user perspective both
> seem to accomplish the same thing and do so very well.

???
try: gem list -r

--
Hassle-free packages for Ruby?
RPA is available from http://www.rubyarchive.org/

Yep, it's true. I'm kind of bleary eyed but if memory serves my problem may
have been heavily related to the fact that my database.yml file had extra
lines at the end. I.e. the configuration ended on line 19 (?) but the file
technically had another two lines in it (looking at it in a utility like
UltraEdit). Fixing that seemed to do the trick if I recall correctly.

Thanks for the idea Curt!

···

-----Original Message-----
From: Curt Hibbs [mailto:curt@hibbs.com]
Sent: Monday, November 29, 2004 8:55 PM
To: ruby-talk ML
Subject: Re: [ANN] postgres-pr (pure Ruby PostgreSQL)

Abraham Vionas wrote:

Thanks for the response Michael!

I looked into the topics you suggested and I think I made some progress...
at least now I can see attempts to connect to the db in the
postgresql log.
However, it says that my user names don't exist, when I know they exist
because I can see them from psql - and from PGAdmin III. Any ideas?

My entry in the database.yml is:

production:
  adapter: postgresql
  database: todo
  host: localhost
  port: 5432
  username: root

Errors in Postgresql log:

2004-11-29 19:49:02 FATAL: user "abrahamvionas_sr " does not exist
2004-11-29 19:57:59 FATAL: user "root " does not exist
2004-11-29 19:58:11 FATAL: user "root " does not exist

From the text above it looks lik you've got a tab character at the end of
your username. Perhaps root<tab> is being sent to the database, keeping the
username from matching. Try deleting this extraneous tab character and see
if that helps.

Curt

-----Original Message-----
From: Michael Neumann [mailto:mneumann@ntecs.de]
Sent: Monday, November 29, 2004 5:14 PM
To: ruby-talk ML
Subject: Re: [ANN] postgres-pr (pure Ruby PostgreSQL)

Abraham Vionas wrote:
> Michael;
>
> Does this mean there is a new Postgres-PR release available for
> download/update?

You already have the newest version (0.2.2).

> Also, I think the problems I'm having with a tutorial I'm
working through
> are related to Activerecord not communicating through PostgresPR...

No, it communicates through PostgresPR, I'm sure!

> It looks like it goes to it's connection_modules directory looking for a
valid
> postgres connector and the default postgres connector included with
> Activerecord doesn't work for some reason. The precise error is below...
but
> I'm curious how I can ensure (what settings to check, file
locations, etc)
> that Activerecord can communicate to and through PostgresPR...?

You don't have to setup anything.

> RuntimeError in Todo#index
>
> authentification failed

The problem is with authentification. You have either specified a wrong
user/password combination for Postgres, or it's an authentification
method that postgres-pr is not-yet capable of. Can you setup your
Postgres-database to either use password-less or plain-text password
authentification?

Regards,

   Michael

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.799 / Virus Database: 543 - Release Date: 11/19/2004

fixed!
fixed!
fixed!

Outstanding!

I've run the test cases. of the 717 assertions, I get only 10 errors,
but they seem to be not postgres-pr specific. I've appended the output
of the test-cases at this email. Maybe someone can take a look at it.

I've released 0.1.1 which fixes all those bugs (except the remaining
10). Update the gem and run the test-cases.

I just updated to 0.1.1 and ran the tests from AR CVS and they all
passed (well, see below).

  1) Error:
test_string_key(PrimaryKeysTest):
RuntimeError: #<ErrorResponse:0x8510570 @field_type=83, @field_values=["ERROR", "C42P01", "Mrelation \"subscribers_nick_seq\" does not exist", "Fnamespace.c", "L193", "RRangeVarGetRelid"]>

... This one I still get but I believe it is a bug in the tests, not
your library (it happens with the C postgres extension as well). It
seems AR is looking for an auto increment sequence on a table using a
text primary key. Haven't looked at it much futher yet.

  2) Error:
test_aggregation_reflection(ReflectionTest):
ActiveRecord::RecordNotFound: Couldn't find Topic with ID = 1
    ./../lib/active_record/base.rb:242:in `find'
    ./reflection_test.rb:13:in `setup_without_fixtures'
    ./../lib/active_record/fixtures.rb:242:in `setup'
    ./../lib/active_record/fixtures.rb:240:in `setup'

I was getting these with 0.1.0 but now I'm not with 0.1.1. They seem
to be working now. This rocks out loud.

-Scott

···

On Fri, 19 Nov 2004 05:31:20 +0900, Michael Neumann <mneumann@ntecs.de> wrote: