Open tomthorogood opened 4 years ago
Hi,
Not sure if it helps you, but I ran into a similar issue. I'm not running db.create_all()
in a test harness, but I am adding some pre-populated data with my own script that does call db.create_all()
and I was getting the exact same error. I'm running Postgres in Docker:
root@5535163b72a5:/# psql -U postgres
psql (9.6.16)
My db name is dftdb
.
postgres=# DROP DATABASE dftdb;
DROP DATABASE
postgres=# CREATE DATABASE dftdb OWNER dftuser;
CREATE DATABASE
postgres=#
The solution does involve installing the btree_gist
extension. You can check if you have the extension available by running SELECT pg_available_extensions();
in psql
. If you don't and you're running Postgres on bare metal you may need to install the related contrib
package for your version of Postgres on your OS. The Docker postgres:9
tag does have this extension available though.
Once the DB is created you connect to it and can then run \dx
to see which extensions are enabled for the database:
postgres=# \c dftdb
You are now connected to database "dftdb" as user "postgres".
dftdb=#
dftdb=# \dx
List of installed extensions
Name | Version | Schema | Description
---------+---------+------------+------------------------------
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
(1 row)
dftdb=#
From here I just installed the extension and ran \dx
again to verify it was installed on the database.
dftdb=# CREATE EXTENSION btree_gist;
CREATE EXTENSION
dftdb=#
dftdb=# \dx
List of installed extensions
Name | Version | Schema | Description
------------+---------+------------+-----------------------------------------------
btree_gist | 1.2 | public | support for indexing common datatypes in GiST
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
(2 rows)
dftdb=#
After that I didn't get any more errors with db.create_all()
. Hope this helps.
You need to install the gist extension for postgres before:
CREATE EXTENSION btree_gist;
I am trying to integrate my application with postgresql-audit, but when my tests run sqlalchemy's
create_all
on our test database instance, I get the following error:I made sure that our test DB is creating the
btree_gist
extension:There is no mention of any additional requirements in the README for this package, so I'm not sure what could be wrong. It feels like every audit history plugin is a dead end, and I was really hopeful this would provide a solution for us.