Setting Postgres extensions via POSTGRESQL_EXTENSIONS env
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
Research direction
Start with the PostgreSQL 15 logic in root/usr/share/container-scripts/postgresql/common.sh around lines 491-498, then inspect the extension test in test/run_test around lines 1079-1088. Reproduce the issue using the provided podman command and verify whether POSTGRESQL_EXTENSIONS is processed during initialization. Done means the reported pg_trgm setup behavior is explained and the test or initialization behavior is corrected.
Written by the indexing model from the issue text.
Description
Hey Gang!
I'm attempting to start Postgres-15 with an extension: POSTGRESQL_EXTENSIONS="pg_trgm" but it does not seem to work as expected
The shell script here seems to be where the action happens:
https://github.com/sclorg/postgresql-container/blob/4d36fddfb7afb5bbb3e1eaa78c3c132f5ee807cb/15/root/usr/share/container-scripts/postgresql/common.sh#L491-L498
For context, I'm setting up a Quay instance with Postgres and that requires the pg_trgm extension.
Steps to reproduce:
##
## Setup storage and fix permissions
##
sudo mkdir -pv /mnt/quay/postgres-data
sudo setfacl -m u:26:-wx /mnt/quay/postgres-data
##
## Run the container
##
sudo podman pod create \
--name quay-pod \
-p 80:8080 \
-p 443:8443
sudo podman run \
--name quay_postgres \
--pod quay-pod \
--rm -d \
-e POSTGRESQL_USER=quayuser \
-e POSTGRESQL_PASSWORD=quaypass \
-e POSTGRESQL_DATABASE=quay \
-e POSTGRESQL_ADMIN_PASSWORD=adminpass \
-e POSTGRESQL_EXTENSIONS="pg_trgm " \
-v /mnt/quay/postgres-data:/var/lib/pgsql/data:Z \
quay.io/fedora/postgresql-15
##
## The verification step will show if the "pg_trgm" extension was installed.
##
sudo podman exec -it quay_postgres psql -U quayuser -d quay -c "\dx pg_trgm"
List of installed extensions
Name | Version | Schema | Description
------+---------+--------+-------------
(0 rows)
The pg_trgm extension does in fact work if setup after the container is running.
sudo podman exec -it quay_postgres psql -U quayuser -d quay -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
sudo podman exec -it quay_postgres psql -U quayuser -d quay -c "\dx pg_trgm"
CREATE EXTENSION
List of installed extensions
Name | Version | Schema | Description
---------+---------+--------+-------------------------------------------------------------------
pg_trgm | 1.6 | public | text similarity measurement and index searching based on trigrams
(1 row)
So it appears the feature to run extensions from the environment variable is not working, at least not in this case.
I see there are tests for the feature:
https://github.com/sclorg/postgresql-container/blob/4d36fddfb7afb5bbb3e1eaa78c3c132f5ee807cb/test/run_test#L1079-L1088
But I'm not sure how well that test works, and I've not tried running the test myself (not yet).
Can somebody chime in and say if the issue is legit?
Thanks in advance!
- Dominant language
- PLpgSQL
- Stars
- 178
- Forks
- 220
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sclorg/postgresql-container
-
Difficulty 2/5 1-2 days Newbie friendliness 72/100
sclorg/postgresql-container#661 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
sclorg/postgresql-container#668 ·
-
Dockerfile failing Open
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
sclorg/postgresql-container#656 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 50/100
sclorg/postgresql-container#654 ·
-
sclorg/postgresql-container#605 · 10 comments · 1 assignee ·
All issues in sclorg/postgresql-container
Similar issues
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
[BUG] A column whose default is the empty string is drawn in the ER diagram as having no default Openbug database-provider good first issue hacktoberfest
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
libredb/libredb-studio#1030 · 6 comments ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug redshift
Difficulty 2/5 1-3 hours Newbie friendliness 88/100