TremalJack
12/28/2021, 9:10 AMTremalJack
12/28/2021, 9:10 AMTremalJack
12/28/2021, 9:21 AMPrefix
12/28/2021, 9:26 PM*
subscription, they do trigger correctly).Prefix
12/28/2021, 9:27 PMchipilov
12/28/2021, 11:28 PMchopper
12/29/2021, 10:30 PMusers
table.
I've created a custom auth flow that makes use of ethereum wallet signatures. The user's id
is basically their wallet address (a string) & is stored in JWT in the sub
claim. When creating my policy, i'm writing it like so auth.uid() = address
but I get an error on the supabase UI that looks like thischopper
12/29/2021, 10:31 PMauth.uid()
is expecting a different type of data. How can I get around this to accomplish what I'm doing here? Any advice is much appreciated. Thanks!garyaustin
12/29/2021, 10:53 PMYANN
12/30/2021, 9:32 AMoskar
12/30/2021, 4:06 PMexecute
and captures
? Would I need to escape something?
SQL
CREATE FUNCTION parse_tokens(content text, prefix text)
RETURNS text[] AS $$
DECLARE
regex text;
matches text;
subquery text;
captures text;
tokens text[];
BEGIN
regex := prefix || '(\S+)';
matches := 'regexp_matches($1, $2, $3) as captures';
subquery := '(SELECT ' || matches || ' ORDER BY captures) as matches';
captures := 'array_agg(matches.captures[1])';
EXECUTE 'SELECT ' || captures || ' FROM ' || subquery
INTO tokens
USING LOWER(content), regex, 'g';
IF tokens IS NULL THEN
tokens = '{}';
END IF;
RETURN tokens;
END;
$$ LANGUAGE plpgsql STABLE;
Jørgen
12/30/2021, 7:41 PMktosiek
12/30/2021, 8:04 PMbh
12/31/2021, 10:24 AMbh
12/31/2021, 11:36 AMTremalJack
12/31/2021, 2:39 PMScott P
12/31/2021, 2:58 PMbh
01/01/2022, 3:00 AMchipilov
01/03/2022, 10:04 AMchipilov
01/03/2022, 6:11 PMkresimirgalic
01/06/2022, 11:23 PMbh
01/07/2022, 12:05 AMCREATE TABLE post (
post_id integer PRIMARY KEY,
...
);
CREATE TABLE post_comment (
post_id integer REFERENCES post ON DELETE CASCADE,
...
);
bh
01/07/2022, 12:06 AMkresimirgalic
01/07/2022, 2:12 PMkresimirgalic
01/07/2022, 2:12 PMktosiek
01/07/2022, 2:55 PMALTER TABLE DROP CONSTRAINT constaint_name
, and then add it back with ALTER TABLE post_comment ADD FOREIGN KEY (post_id) REFERENCES post (post_id) ON DELETE CASCADE
ktosiek
01/07/2022, 2:55 PMktosiek
01/07/2022, 2:56 PMkresimirgalic
01/07/2022, 3:35 PMcreate or replace function get_feed_posts() returns setof feed
as $func$
SELECT *
, (SELECT COUNT(*) FROM feed_activities WHERE feed_ref=feed.id and type = 'like') as LIKE_COUNT
, (SELECT COUNT(*) FROM feed_activities WHERE feed_ref=feed.id and type = 'comment') as COMMENT_COUNT
FROM feed
$func$
language sql;
kresimirgalic
01/07/2022, 3:36 PM