kresimirgalic
01/07/2022, 3:36 PMreturn type mismatch in function declared to return feed
florian-lefebvre
01/07/2022, 4:53 PMpgsql
create table categories (
id bigint generated by default as identity,
title varchar not null,
parent_id bigint references categories (id),
primary key (id),
unique (title)
);
create table resources (
id bigint generated by default as identity,
title varchar not null,
url varchar not null,
description varchar not null,
date timestamp with time zone,
author varchar not null,
primary key (id)
);
create table categories_to_resources (
id bigint generated by default as identity,
category_id bigint references categories (id),
resource_id bigint references resources (id),
primary key (id)
);
As you can see in categories
, the parent_id
refers to another category.
So here is what I want to achieve: on the frontend, i need to know if a category with id
= X is empty, i.e. if it has subcategories or resources.
So I need to check how many categories
there are with parent_id
= X and how many resources_to_categories
have category_id
= X.
But I don't wan't to add another request from the frontend so I thought I could add it as a sql statement in a column or in a view to get the following:
text
CATEGORIES
id | title | parent_id | count
autogenerated | user provided | user provided | sum of 2 counts (the ones I talked above)
How can I achieve that?kresimirgalic
01/07/2022, 5:36 PMktosiek
01/07/2022, 6:20 PMTremalJack
01/07/2022, 7:44 PMTremalJack
01/07/2022, 7:45 PMTremalJack
01/07/2022, 7:46 PMgaryaustin
01/07/2022, 8:36 PMbent
01/08/2022, 12:44 AMdelete from auth.users where email like "%foo@mail.com";
should this work? Trying to get rid of some test accounts from the UI right nowbent
01/08/2022, 12:44 AMcolumn "%foo@mail.com" does not exist
as an error 🤔bent
01/08/2022, 12:59 AMemail:varchar
instead of just email
for this to worktourdownunder
01/08/2022, 12:59 AM"
and use single '
insteadbent
01/08/2022, 12:59 AMstranger
01/08/2022, 12:23 PMflorian-lefebvre
01/08/2022, 3:46 PMrazokulover
01/09/2022, 9:36 AMoliviercp
01/09/2022, 5:35 PMsilentworks
01/10/2022, 9:23 AMsilentworks
01/10/2022, 9:29 AMlogemann
01/11/2022, 12:40 PMcharles.morrow
01/11/2022, 4:21 PM((role() = 'authenticated'::text) AND (uid() = '057b1bc4-b79b-46ae'::uuid))
it works
but if i say ((role() = 'authenticated'::text) AND (uid() IN ( SELECT admin.user_uuid FROM admin)))
it doesnt work
there is a row with that user_uuid in the admin table.
Can anyone see what im doing wrong? thanks!mattmatt
01/11/2022, 5:58 PMmattmatt
01/11/2022, 6:07 PMselect xpath((mypage::html), '//a/text()') from crawler.output
garyaustin
01/11/2022, 6:25 PMsilentworks
01/11/2022, 7:56 PMDenzo
01/12/2022, 2:36 PMSELECT
, INSERT
and UPDATE
to be publically accessible with the Anon key, but only if the user knows either the deviceId
or userId
. I can't use auth().id
because I want the API to be accessible even for users that have not yet registered. I just want people to prevent from querying the entire DB. How would I implement this using a policy?jaf
01/12/2022, 2:38 PMproducts
table. The products
table has a supplier_id
field that references the suppliers
table. The suppliers
table has a user_id
field that references the user. The RLS policy fo the suppliers table is very simple: (uid() = user_id)
. But I struggle to create the more complex policy required to protect the products
based on that relationship.Scott P
01/12/2022, 3:24 PMjason-lynx
01/13/2022, 9:26 AMchipilov
01/13/2022, 11:56 AM