supabase / pg_jsonschema

PostgreSQL extension providing JSON Schema validation
Apache License 2.0
1.03k stars 30 forks source link

error creating the pg_jsonschema v0.1.3 extension installed from the deb package #20

Closed vitabaks closed 1 year ago

vitabaks commented 1 year ago

ERROR: could not open extension control file "/usr/share/postgresql/14/extension/pg_jsonschema.control": No such file or directory

Steps:

root@66346c8b7da8:/# wget https://github.com/supabase/pg_jsonschema/releases/download/v0.1.3/pg_jsonschema-v0.1.3-pg14-amd64-linux-gnu.deb
--2022-12-01 19:04:37--  https://github.com/supabase/pg_jsonschema/releases/download/v0.1.3/pg_jsonschema-v0.1.3-pg14-amd64-linux-gnu.deb
Resolving github.com (github.com)... 140.82.114.3
Connecting to github.com (github.com)|140.82.114.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/472775521/893f7f55-8947-49b6-9b0f-fcc20975cffc?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20221201%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221201T190437Z&X-Amz-Expires=300&X-Amz-Signature=04f8afaa4c378359ff1a2660b074e410a520816c2c83a78fc6df5809bdfb8fb6&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=472775521&response-content-disposition=attachment%3B%20filename%3Dpg_jsonschema-v0.1.3-pg14-amd64-linux-gnu.deb&response-content-type=application%2Foctet-stream [following]
--2022-12-01 19:04:37--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/472775521/893f7f55-8947-49b6-9b0f-fcc20975cffc?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20221201%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221201T190437Z&X-Amz-Expires=300&X-Amz-Signature=04f8afaa4c378359ff1a2660b074e410a520816c2c83a78fc6df5809bdfb8fb6&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=472775521&response-content-disposition=attachment%3B%20filename%3Dpg_jsonschema-v0.1.3-pg14-amd64-linux-gnu.deb&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.111.133, 185.199.110.133, 185.199.109.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1170900 (1.1M) [application/octet-stream]
Saving to: ‘pg_jsonschema-v0.1.3-pg14-amd64-linux-gnu.deb’

pg_jsonschema-v0.1.3-pg14-amd64-linux-gnu.deb  100%[=================================================================================================>]   1.12M  --.-KB/s    in 0.005s  

2022-12-01 19:04:37 (208 MB/s) - ‘pg_jsonschema-v0.1.3-pg14-amd64-linux-gnu.deb’ saved [1170900/1170900]

root@66346c8b7da8:/# dpkg -i pg_jsonschema-v0.1.3-pg14-amd64-linux-gnu.deb
(Reading database ... 15347 files and directories currently installed.)
Preparing to unpack pg_jsonschema-v0.1.3-pg14-amd64-linux-gnu.deb ...
Unpacking pg-jsonschema (0.1.3) over (0.1.3) ...
Setting up pg-jsonschema (0.1.3) ...
root@66346c8b7da8:/# 
root@66346c8b7da8:/# dpkg -l | grep jsonschema
ii  pg-jsonschema                      0.1.3                          amd64        A PostgreSQL extension
root@66346c8b7da8:/# 

root@66346c8b7da8:/# ls -l /usr/share/postgresql/14/extension/pg_jsonschema.control
ls: cannot access '/usr/share/postgresql/14/extension/pg_jsonschema.control': No such file or directory

root@66346c8b7da8:/# find / -name pg_jsonschema*
/pg_jsonschema-v0.1.3-pg14-amd64-linux-gnu.deb
root@66346c8b7da8:/# 

root@66346c8b7da8:/# cat /etc/issue.net 
Debian GNU/Linux 11
olirice commented 1 year ago

the release .deb assets are intended for use on the supabase platform

You could potentially move the assets from where supabase expects them

/usr/lib/postgresql/lib
/var/lib/postgresql/extension

to where your postgres installation is expecting (from the trace)

/usr/lib/postgresql/14/lib
/var/lib/postgresql/14/extension

Or you could install from source using the instructions in this repos README.


I'm not a packaging expert so If there's a way to make these assets more widely compatible to e.g. make the install path dynamic based on the system's pg_config a PR would be very welcome