PostgreSQL third party extensions "pg_trgm" requiring Superuser Rights unable to use on Shared Hosting providers (example: A2hosting, pythonanywhere)
See original GitHub issueUsing the flag set to false, the outdated extension “hstore” is not more required, this works greats https://github.com/mirumee/saleor/issues/5542 👍
Following on the installation of Saleor on shared hosting services : At the step : # python manage.py migrate
The migrations starts and works now fine except that it stops at this file : 0037_auto_20171124_0847.py
When digging into it. The problem is the way the database migration is handled. Having to rely on third party PostgreSQL extensions is creating and will create this problem on any Shared Hosting providers, reducing the scope of Saleor.
So it seem this process needs to be extended to the extensions used for the database migrations. Digging into the topic, Oracle communicated as well on this issue when one migrates their database to PostgreSQL.
We need to bypass or process manually this extension “pg_trgm” as well.
Running migrations:
Applying product.0022_auto_20161212_0301... OK
Applying product.0023_auto_20161211_1912... OK
Applying product.0024_migrate_json_data... OK
Applying product.0025_auto_20161219_0517... OK
Applying product.0026_auto_20161230_0347... OK
Applying product.0027_auto_20170113_0435... OK
Applying product.0013_auto_20161130_0608... OK
Applying product.0014_remove_productvariant_attributes... OK
Applying product.0015_productvariant_attributes... OK
Applying product.0016_auto_20161204_0311... OK
Applying product.0017_attributechoicevalue_slug... OK
Applying product.0018_auto_20161212_0725... OK
Applying product.0026_merge_20161221_0845... OK
Applying product.0028_merge_20170116_1016... OK
Applying product.0029_product_is_featured... OK
Applying product.0030_auto_20170206_0407... OK
Applying product.0031_auto_20170206_0601... OK
Applying product.0032_auto_20170216_0438... OK
Applying product.0033_auto_20170227_0757... OK
Applying product.0034_product_is_published... OK
Applying product.0035_auto_20170919_0846... OK
Applying product.0036_auto_20171115_0608... OK
Applying product.0037_auto_20171124_0847...Traceback (most recent call last):
File "/virtualenv/web/3.7/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.InsufficientPrivilege: permission denied to create extension "pg_trgm"
HINT: Must be superuser to create this extension.
For that we would need to change the logic of the product search: https://github.com/mirumee/saleor/blob/d0f029e3c30d3ff64b01c60f3c0033febc69235c/saleor/search/backends/postgresql_storefront.py#L7-L24
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
I suggest trying to resolve this with your hosting provider instead of looking for ways around this limitation. They should be able to create the extension in the
template1
database and have it automatically available for all customers.While we could write a custom pure-SQL n-gram implementation, I doubt we could match the performance of
pg_trgm
, it would require us to create custom Django wrappers for the filters and indexes, and I’m not looking forward to maintaining all of this code.This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.