michelp / pgjwt

PostgreSQL implementation of JWT (JSON Web Tokens)
MIT License
364 stars 60 forks source link

only pgjwt version 0.1.1 is available for installation on PostgreSQL 9.6 #23

Open vitabaks opened 1 year ago

vitabaks commented 1 year ago

Error installing pgjwt 0.2.0 the extension on PostgreSQL 9.6

postgres=# CREATE EXTENSION pgjwt;
ERROR:  required extension "pgcrypto" is not installed
HINT:  Use CREATE EXTENSION ... CASCADE to install required extensions too.
postgres=# CREATE EXTENSION pgjwt CASCADE;
NOTICE:  installing required extension "pgcrypto"
ERROR:  could not stat file "/usr/share/postgresql/9.6/extension/pgjwt--0.2.0.sql": No such file or directory
postgres=# \dx
                 List of installed extensions
  Name   | Version |   Schema   |         Description          
---------+---------+------------+------------------------------
 plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language
(1 row)

postgres=# select name, default_version as version, comment from pg_available_extensions where name like '%pgjwt%' order by 1;
 name  | version |              comment              
-------+---------+-----------------------------------
 pgjwt | 0.2.0   | JSON Web Token API for Postgresql
(1 row)
-rw-r--r-- 1 root root    2123 Oct 17 17:49 pgjwt--0.1.0--0.1.1.sql
-rw-r--r-- 1 root root    1010 Oct 17 17:49 pgjwt--0.1.1--0.2.0.sql
-rw-r--r-- 1 root root    2123 Oct 17 17:49 pgjwt--0.1.1.sql
-rw-r--r-- 1 root root     148 Oct 17 17:49 pgjwt.control
root@ebb360ee2127:/# 

Although there is a file "pgjwt--0.1.1--0.2.0.sql", we can only install version 0.1.1

lists the specific extension versions that are available for installation.

postgres=# select * from pg_available_extension_versions where name = 'pgjwt' order by version desc;
 name  | version | installed | superuser | relocatable | schema |  requires  |              comment              
-------+---------+-----------+-----------+-------------+--------+------------+-----------------------------------
 pgjwt | 0.1.1   | f         | f         | f           |        | {pgcrypto} | JSON Web Token API for Postgresql
(1 row)
postgres=# CREATE EXTENSION pgjwt WITH VERSION '0.1.1' CASCADE;
NOTICE:  installing required extension "pgcrypto"
CREATE EXTENSION
postgres=# \dx
                    List of installed extensions
   Name   | Version |   Schema   |            Description            
----------+---------+------------+-----------------------------------
 pgcrypto | 1.3     | public     | cryptographic functions
 pgjwt    | 0.1.1   | public     | JSON Web Token API for Postgresql
 plpgsql  | 1.0     | pg_catalog | PL/pgSQL procedural language
(3 rows)

And we can update the extension to version 0.2.0

postgres=# ALTER EXTENSION pgjwt UPDATE ;
ALTER EXTENSION
postgres=# \dx
                    List of installed extensions
   Name   | Version |   Schema   |            Description            
----------+---------+------------+-----------------------------------
 pgcrypto | 1.3     | public     | cryptographic functions
 pgjwt    | 0.2.0   | public     | JSON Web Token API for Postgresql
 plpgsql  | 1.0     | pg_catalog | PL/pgSQL procedural language
(3 rows)

I expect there will be an option to install the latest version with the command CREATE EXTENSION pgjwt;

vitabaks commented 1 year ago

no problem installing the extension on PostgreSQL 10, 11, 12, 13, 14, and 15

psql (10.22 (Debian 10.22-1.pgdg110+1))
Type "help" for help.

postgres=# CREATE EXTENSION pgjwt CASCADE;
NOTICE:  installing required extension "pgcrypto"
CREATE EXTENSION
postgres=# \dx
                    List of installed extensions
   Name   | Version |   Schema   |            Description            
----------+---------+------------+-----------------------------------
 pgcrypto | 1.3     | public     | cryptographic functions
 pgjwt    | 0.2.0   | public     | JSON Web Token API for Postgresql
 plpgsql  | 1.0     | pg_catalog | PL/pgSQL procedural language
(3 rows)
psql (15.0 (Debian 15.0-1.pgdg110+1))
Type "help" for help.

postgres=# CREATE EXTENSION pgjwt CASCADE;
NOTICE:  installing required extension "pgcrypto"
CREATE EXTENSION
postgres=# \dx
                    List of installed extensions
   Name   | Version |   Schema   |            Description            
----------+---------+------------+-----------------------------------
 pgcrypto | 1.3     | public     | cryptographic functions
 pgjwt    | 0.2.0   | public     | JSON Web Token API for Postgresql
 plpgsql  | 1.0     | pg_catalog | PL/pgSQL procedural language
(3 rows)