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

**URL:** https://forum.crystal-lang.org/t/postgresql-db-open-does-not-work-in-crystal-v-0-35/2236
**Category:** Help & Support
**Created:** [June 13, 2020, 6:08am UTC](https://forum.crystal-lang.org/t/postgresql-db-open-does-not-work-in-crystal-v-0-35/2236 "2020-06-13T06:08:24Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Geo-7](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/geo-7/32/816_2.png) [@Geo-7](https://forum.crystal-lang.org/u/Geo-7)
#### Post date: [June 13, 2020, 6:08am UTC](https://forum.crystal-lang.org/t/postgresql-db-open-does-not-work-in-crystal-v-0-35/2236/1 "2020-06-13T06:08:24Z")

</div>

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](https://github.com/will/crystal-pg)

---

<div class="post-metadata">

### Author: ![Blacksmoke16](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/blacksmoke16/32/1241_2.png) [@Blacksmoke16](https://forum.crystal-lang.org/u/Blacksmoke16)
#### Post date: [June 13, 2020, 6:14am UTC](https://forum.crystal-lang.org/t/postgresql-db-open-does-not-work-in-crystal-v-0-35/2236/2 "2020-06-13T06:14:45Z")

</div>

Update to [https://github.com/will/crystal-pg/releases/tag/v0.21.1](https://github.com/will/crystal-pg/releases/tag/v0.21.1) that release.

---

<div class="post-metadata">

### Author: ![Geo-7](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/geo-7/32/816_2.png) [@Geo-7](https://forum.crystal-lang.org/u/Geo-7)
#### Post date: [June 13, 2020, 6:28am UTC](https://forum.crystal-lang.org/t/postgresql-db-open-does-not-work-in-crystal-v-0-35/2236/3 "2020-06-13T06:28:58Z")

</div>

Thanks but why **shards install** install the older version?

```auto
name: pg
version: 0.21.0

dependencies:
  db:
    github: crystal-lang/crystal-db
    version: ~> 0.9.0

```

---

<div class="post-metadata">

### Author: ![Blacksmoke16](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/blacksmoke16/32/1241_2.png) [@Blacksmoke16](https://forum.crystal-lang.org/u/Blacksmoke16)
#### Post date: [June 13, 2020, 6:30am UTC](https://forum.crystal-lang.org/t/postgresql-db-open-does-not-work-in-crystal-v-0-35/2236/4 "2020-06-13T06:30:38Z")

</div>

Because it’s probably respecting your `shard.lock` file. You need to run `shards update`, after changing the version in your `shard.yml`.

---

<div class="post-metadata">

### Author: ![Geo-7](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/geo-7/32/816_2.png) [@Geo-7](https://forum.crystal-lang.org/u/Geo-7)
#### Post date: [June 13, 2020, 6:34am UTC](https://forum.crystal-lang.org/t/postgresql-db-open-does-not-work-in-crystal-v-0-35/2236/5 "2020-06-13T06:34:34Z")

</div>

Thanks, your guess was right.
