# Minimum postgresql version?

**URL:** <https://drone.discourse.group/t/minimum-postgresql-version/5093>\
**Category:** Drone Support\
**Created:** [March 7, 2018, 5:48pm UTC](https://drone.discourse.group/t/minimum-postgresql-version/5093 "2018-03-07T17:48:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![carlwgeorge](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/carlwgeorge/32/5105_2.png) [@carlwgeorge](https://drone.discourse.group/u/carlwgeorge)\
**Post date:** [March 7, 2018, 5:48pm UTC](https://drone.discourse.group/t/minimum-postgresql-version/5093/1 "2018-03-07T17:48:36Z")

</div>

Is there a minimum version requirement for using postgresql with drone? I’m attempting to use postgresql 9.2.23 with drone 0.8.4, and getting this error:

```auto
ERRO[0000] pq: syntax error at or near "NOT"            
FATA[0000] migration failed

```

I’m aware that 9.2 is end of life upstream, but it is still supported by Red Hat in RHEL 7 until 2024, so I would like to use it if possible.

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [March 7, 2018, 6:00pm UTC](https://drone.discourse.group/t/minimum-postgresql-version/5093/2 "2018-03-07T18:00:40Z")

</div>

I believe 9.6 is the minimum, which is the version we run our unit tests against. Drone takes advantage of at least two syntax features that are only available in more recent versions:

- `IF NOT EXISTS` for creating indexes in our migration script
- `INSERT IGNORE` for synchronizing data

The latter is core to how Drone works, so unfortunately there is no easy way to fallback to older versions of postgres without this capability.

---

<div class="post-metadata">

**Author:** ![carlwgeorge](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/carlwgeorge/32/5105_2.png) [@carlwgeorge](https://drone.discourse.group/u/carlwgeorge)\
**Post date:** [March 7, 2018, 7:31pm UTC](https://drone.discourse.group/t/minimum-postgresql-version/5093/3 "2018-03-07T19:31:19Z")

</div>

Thanks for that clarification. Postgresql 9.6 is doable on RHEL 7, either via [https://yum.postgresql.org](https://yum.postgresql.org) or Red Hat’s rh-postgresql96 software collection. My main motivation for using the default 9.2 was the longer support lifecycle.

Is there a minimum version of mysql/mariadb required? RHEL 7 ships mariadb 5.5.56, and I may just use that instead. In fact, I guess the overall ask here is can the minimum database versions required be added to the documentation? I’m happy to send a pull request for this if you let me know the versions.

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [March 7, 2018, 7:49pm UTC](https://drone.discourse.group/t/minimum-postgresql-version/5093/4 "2018-03-07T19:49:20Z")

</div>

I am not sure the exact minimum version, unfortunately, but we use mysql 5.6.27 for our unit tests. It could work with older versions as well.

If you are open to running the unit tests against older mysql versions to determine the minimum required version, and updating the docs, it would definitely be appreciated. You can run the mysql tests in isolation with the following command:

```auto
export DATABASE_DRIVER=mysql
export DATABASE_CONFIG=root@tcp(localhost:3306)/test?parseTime=true
go test github.com/drone/drone/store/datastore

```

---

<div class="post-metadata">

**Author:** ![carlwgeorge](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/carlwgeorge/32/5105_2.png) [@carlwgeorge](https://drone.discourse.group/u/carlwgeorge)\
**Post date:** [March 7, 2018, 10:02pm UTC](https://drone.discourse.group/t/minimum-postgresql-version/5093/5 "2018-03-07T22:02:22Z")

</div>

Based on the unit tests, it appears RHEL 6’s mysql 5.1 and RHEL 7’s mariadb 5.5 are sufficient.

```nohighlight
[root@el6 ~]# rpm -q mysql-server
mysql-server-5.1.73-8.el6_8.x86_64
[root@test6 ~]# go test github.com/drone/drone/store/datastore
ok github.com/drone/drone/store/datastore	0.933s

```

```nohighlight
[root@el7 ~]# rpm -q mariadb-server
mariadb-server-5.5.56-2.el7.x86_64
[root@el7 ~]# go test github.com/drone/drone/store/datastore
ok github.com/drone/drone/store/datastore	1.063s

```

I also ran the tests with various postgresql versions. 9.2 and 9.4 failed with the same error as I originally posted. 9.5 did pass however. Would you consider a pull request that adds more pipeline steps (and corresponding services) to drone’s `.drone.yml` to test multiple versions of mysql/mariadb and postgresql? I think it may be prudent to just have the database config docs point to the `.drone.yml` file for compatible database versions, rather than having docs get out of sync with reality.
