michelp / pgjwt

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

pgjwt extension sql code error in Windows #8

Closed Rackar closed 6 years ago

Rackar commented 6 years ago

Environment

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.