devbox
devbox copied to clipboard
Unable to use "h3" extension with PostgreSQL
What happened?
I have a use case where I need both h3 and postgis extensions in PostgreSQL. I followed the steps mentioned #912, which seem to work for getting postgis to work. I figured adding h3-pg to withPackages would do the trick:
# Before
...
postgresql = pkgs.postgresql_16.withPackages (p: [ p.postgis ]);
...
# After
...
postgresql = pkgs.postgresql_16.withPackages (p: [ p.postgis p.h3-pg ]);
...
I use the combination of initdb and pg_ctl -D <path> start to the PostgreSQL server, then I connect using psql -h localhost postgres and list available extensions:
SELECT * FROM pg_available_extensions;
...
h3 | 4.1.3 | | H3 bindings for PostgreSQL
...
CREATE EXTENSION h3;
2024-07-31 15:13:32.367 MDT [73097] ERROR: could not access file "h3": No such file or directory
2024-07-31 15:13:32.367 MDT [73097] STATEMENT: CREATE EXTENSION h3;
ERROR: could not access file "h3": No such file or directory
When I do the same thing for postgis, it creates the extension without issues:
SELECT * FROM pg_available_extensions;
...
postgis | 3.4.2 | | PostGIS geometry and geography spatial types and functions
...
CREATE EXTENSION postgis;
CREATE EXTENSION
I also see the extension present in the Nix Store:
ls (pg_config --sharedir)/extension
...
h3--4.1.3.sql -> /nix/store/n0iac6vx6q17s1wxjddzbl55p8kmabl8-h3-pg-4.1.3/share/postgresql/extension/h3--4.1.3.sql
h3.control -> /nix/store/n0iac6vx6q17s1wxjddzbl55p8kmabl8-h3-pg-4.1.3/share/postgresql/extension/h3.control
h3_postgis--4.1.3.sql -> /nix/store/n0iac6vx6q17s1wxjddzbl55p8kmabl8-h3-pg-4.1.3/share/postgresql/extension/h3_postgis--4.1.3.sql
h3_postgis.control -> /nix/store/n0iac6vx6q17s1wxjddzbl55p8kmabl8-h3-pg-4.1.3/share/postgresql/extension/h3_postgis.control
...
Any ideas?
Steps to reproduce
Command
shell
devbox.json
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.12.0/.schema/devbox.schema.json",
"packages": [
"path:postgres#postgresql"
],
"shell": {
"scripts": {
"test": [
"echo \"Error: no test specified\" && exit 1"
]
}
},
"include": [
"plugin:postgresql"
]
}
Devbox version
0.12.0
Nix version
2.21.0
What system does this bug occur on?
macOS (Apple Silicon)
Debug logs
No response
Same issue on macos