Forum: Ruby Ugly bug with one-click installer and postgres-pr

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Daniel B. (Guest)
on 2006-02-18 05:51
(Received via mailing list)
Windows XP Pro
dbi 0.0.23
postgres-pr 0.4.0
Ruby one-click installer, p3

I'm getting a rather ugly bug when I try to connect to a PostgreSQL
database using the one click installer.  Any ideas?

# If I don't include the username

C:\ruby2\src\ruby-dbi-all>c:\ruby2\bin\irb
irb(main):001:0> VERSION
=> "1.8.4"
irb(main):002:0> require "dbi"
=> true
irb(main):003:0> DBI::VERSION
=> "0.0.23"
irb(main):004:0> dbh = DBI.connect('dbi:Pg:cdlib_development')
RuntimeError: FATAL     C28000  Mno PostgreSQL user name specified in
startup packet    Fpostmaster.c   L1537   RProcess
StartupPacket
        from
c:/ruby2/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/connection.rb:55:in
`initialize'
        from
c:/ruby2/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/connection.rb:29:in
`initialize'
        from
c:/ruby2/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/postgres-compat.rb:23:in
`initialize'
        from c:/ruby2/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:96:in
`initialize'
        from c:/ruby2/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:55:in
`connect'
        from c:/ruby2/lib/ruby/site_ruby/1.8/dbi/dbi.rb:584:in
`connect'
        from c:/ruby2/lib/ruby/site_ruby/1.8/dbi/dbi.rb:384:in
`connect'
        from (irb):4

# If I add the username

irb(main):005:0> dbh =
DBI.connect('dbi:Pg:cdlib_development','postgres')
Errno::EINVAL: Invalid argument
        from c:/ruby2/lib/ruby/1.8/readbytes.rb:16:in `read'
        from c:/ruby2/lib/ruby/1.8/readbytes.rb:16:in `readbytes'
        from
c:/ruby2/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/message.rb:32:in
`read'
        from
c:/ruby2/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/connection.rb:30:in
`initialize'
        from
c:/ruby2/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/connection.rb:29:in
`initialize'
        from
c:/ruby2/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/postgres-compat.rb:23:in
`initialize'
        from c:/ruby2/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:96:in
`initialize'
        from c:/ruby2/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:55:in
`connect'
        from c:/ruby2/lib/ruby/site_ruby/1.8/dbi/dbi.rb:584:in
`connect'
        from c:/ruby2/lib/ruby/site_ruby/1.8/dbi/dbi.rb:384:in
`connect'
        from (irb):5

I do NOT see this behavior with a hand built 1.8.4.  Compiler issue?
How that would make a difference with a pure Ruby driver I'm not sure,
but it seems to.

Regards,

Dan
Guest (Guest)
on 2006-03-04 01:55
I tracked this down into readbytes.rb, which is a standard ruby library.
It is where a 1 (Fixnum) gets passed in.  I tried putting rescu around
it an
hard coding in the 1 but that also fails.
That is very strange because IO.read should take a 1.
This topic is locked and can not be replied to.