question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PostgreSQL third party extensions "pg_trgm" requiring Superuser Rights unable to use on Shared Hosting providers (example: A2hosting, pythonanywhere)

See original GitHub issue

Using 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:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
patryscommented, May 4, 2020

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.

0reactions
stale[bot]commented, Jul 4, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Started with Postgres - PythonAnywhere help
On the Databases tab, find the "Postgres Superuser password" form and enter a password. Note the instructions re: it being stored in plaintext...
Read more >
Con not connect to postgres sql on Django app : Forums
with following setting i am not able to connect database . since i ... we set up a user called "super", with full...
Read more >
PG : Forums - PythonAnywhere
9.0: This release of PostgreSQL adds features that have been requested for years, such as easy-to-use replication, a mass permission-changing ...
Read more >
(Pythonanywhere) is the server running on host <...> postgres ...
Do you know what the issue is? My db settings i used credintials are below and also my pythonanywhere host, port and superuser...
Read more >
Phppgadmin Not Able To Login, Where Python Psycopg2 Is ...
third party extensions pgtrgm requiring Superuser Rights unable to use on Shared Hosting providers example: A2hosting pythonanywhere. Using the flag.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found