Closed xavicolomer closed 7 years ago
I found way link the hashid to a query but it looks complicated. I want to get rid of the {} returned by id_decode.
Is there a simpler way rather than:
SELECT * FROM mytable, (SELECT CAST(translate(id_decode('my_id', 'my_salt', 10)::text, '{}', '') as int4) as id) as hash WHERE mytable.id = hash.id;
I tried comparing the value directly:
ERROR: operator does not exist: integer = bigint[]
And CAST the result as int4 :
CAST(id_decode('my_id', 'my_salt', 10)::text, '{}', '') as int4)
@xavicolomer You can use id_decode_once which returns BIGINT. I will update the readme soon :)
id_decode_once
BIGINT
I found way link the hashid to a query but it looks complicated. I want to get rid of the {} returned by id_decode.
Is there a simpler way rather than:
I tried comparing the value directly:
ERROR: operator does not exist: integer = bigint[]
And CAST the result as int4 :
CAST(id_decode('my_id', 'my_salt', 10)::text, '{}', '') as int4)