michelp / pgjwt

PostgreSQL implementation of JWT (JSON Web Tokens)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pgjwt extension sql code error in Windows

Rackar opened this issue · comments

commented

Environment

  • PostgreSQL version: 10.4
  • PostgREST version: 5.0
  • Operating system: Windows

Description of issue

for install the pgjwt extension in the windows, i follow the docs and paste the sql code into postgres to the functions
CREATE OR REPLACE FUNCTION url_encode ...
CREATE OR REPLACE FUNCTION url_decode ...
thats ok. but then next error:

CREATE OR REPLACE FUNCTION sign(payload json, secret text, algorithm text DEFAULT 'HS256')
RETURNS text LANGUAGE sql AS $$
WITH
  header AS (
    SELECT @extschema@.url_encode(convert_to('{"alg":"' || algorithm || '","typ":"JWT"}', 'utf8')) AS data
    ),
  payload AS (
    SELECT @extschema@.url_encode(convert_to(payload::text, 'utf8')) AS data
    ),
  signables AS (
    SELECT header.data || '.' || payload.data AS data FROM header, payload
    )
SELECT
    signables.data || '.' ||
    @extschema@.algorithm_sign(signables.data, secret, algorithm) FROM signables;
$$;

error:
@extschema@.url_encode
_______________^
Syntax Error near the dot.