will / crystal-pg

a postgres driver for crystal
BSD 3-Clause "New" or "Revised" License
462 stars 77 forks source link

Postgresql DB.open does not work in crystal V-0.35 #207

Closed Geo-7 closed 4 years ago

Geo-7 commented 4 years ago

Hi After upgrading crystal to version v.35: db = DB.open "postgres://username:password@192.168.1.1/mydb" in my main application I got this error:

In /usr/share/crystal/src/io.cr:845:34

 845 | def write_byte(byte : UInt8) : Int64
                                      ^
Error: method must return Int64 but it is returning (Int64 | Nil)

after create a simple new file with only db.open

In lib/pg/src/pq/connection.cr:362:13

 362 | ctx.update(inner.to_unsafe, inner.bytesize.to_u32)
           ^-----
Error: wrong number of arguments for 'OpenSSL::Digest#update' (given 2, expected 1)

I am using will/crystal-pg

will commented 4 years ago

I think you need to update to the newest version of crystal-pg 0.21.1

Geo-7 commented 4 years ago

Thanks but why shards install install the older version?

name: pg
version: 0.21.0

dependencies:
  db:
    github: crystal-lang/crystal-db
    version: ~> 0.9.0
Geo-7 commented 4 years ago

Thank you It was because of my shard.lock new version solved the issue.