James Q Quick
06/17/2022, 7:11 PMInvoice
has many LineItems
. My db model is setup where the LineItem
has a reference as invoiceId
to the primary key of the corresponding invoice. I'm wondering how can query and create invoices that includes that line items themselves? The only thing I found in the docs is to include the foreign key relationship which I already have setup. So, I know I can query an invoice from a line item, but how do I query line items from an invoice?Adi
06/17/2022, 9:24 PMNin
06/17/2022, 9:32 PMCertinax
06/17/2022, 10:38 PMservice_role
- Grant usage on schema with authenticated
- Create policy on `auth.users`for delete to authenticated
My response:
message: 'permission denied for table users',
code: '42501',
Any suggestions or other workarounds? 👼
My latest attempt:
create or replace function cleanup_user ()
returns boolean
language plpgsql
as
$$
begin
SET ROLE TO service_role;
delete from auth.users where id = auth.uid();
return true;
end;
$$
DanMossa
06/17/2022, 11:14 PMTriggers
?
And It seems like Functions
are postgres RPC functions, but then what are Edge Functions?Nin
06/17/2022, 11:46 PMkudziak
06/18/2022, 5:13 AMNin
06/18/2022, 9:43 AMs c a p e g o a t
06/18/2022, 10:45 AM!inner
join function in the JS client.
Currently the data I get from the database is like the image on the left. The database returns me an array of object which contains another object called images
with the url
inside it.
What I want to do is tell Postgres to return only array of urls
from the the images
table, which were obtained through the !inner
join function via the table item_image
.
(Continue in the thread --->)Albert [tox/cis]
06/18/2022, 12:43 PMAn error has occured: Failed to fetch
. Why is this happening?CEbbinghaus
06/18/2022, 1:00 PMHaus Of Alejandro
06/18/2022, 1:57 PMMyNameUndefined
06/18/2022, 3:39 PMBicijay
06/18/2022, 4:53 PMNin
06/18/2022, 6:12 PMconst { user } = supabaseClient.auth.setAuth(req.headers.get('Authorization')!.replace('Bearer ', ''))
console.log(user)
Rickert
06/18/2022, 9:52 PMalejojm1201
06/19/2022, 2:24 AMDanMossa
06/19/2022, 2:41 AMsascha
06/19/2022, 9:43 AMphilnat0r
06/19/2022, 11:43 AMauth
schema, but I get an error.
Query:
let q = supabase
.from<Message[]>('messages')
.select('*, channel:channel_id(id, name), user:user_id(id, email)')
.order('created_at', { ascending: false })
.limit(100)
Error:
"Could not find a relationship between 'messages' and 'user_id' in the schema cache"`
Baorong Huang
06/19/2022, 1:23 PMDevowl
06/19/2022, 1:32 PMcreate or replace function public.getDepotStats()
RETURNS TABLE(id uuid, name varchar, number varchar, owner_id uuid, created_at timestamptz,totalExports bigint, totalGainLoss float)
language sql
SECURITY INVOKER
AS $$
SELECT depots.id,depots.name,depots.number,depots.owner_id,depots.created_at,
(SELECT COUNT(*) FROM depot_exports WHERE depot_exports.depot_id= depots.id) as totlaExports,
(SELECT win_loss_amount FROM depot_exports WHERE depot_exports.depot_id= depots.id ORDER BY export_time DESC LIMIT 1) as totalGainLoss
FROM depots
ORDER BY depots.name;
$$;
Using Flutter/Dart as a client I get the message:
PostgrestError (PostgrestError(message: Could not find the public.getDepotStats() function or the public.getDepotStats function with a single unnamed json or jsonb parameter in the schema cache, code: PGRST202, details: null, hint: If a new function was created in the database with this name and parameters, try reloading the schema cache.))
Any suggestions, ideas what I did wrong?Nin
06/19/2022, 3:14 PMVillage
06/19/2022, 4:52 PMNin
06/19/2022, 5:16 PMkirk douglas
06/19/2022, 6:04 PMNin
06/19/2022, 8:05 PMif new.invited_at IS NOT NULL
The if statement itself works fine, however, invited_at is checked and is seen as null even though it's not. Any clue what's happening?Nin
06/19/2022, 9:30 PMsupabaseClient.auth.api.inviteUserByEmail('john.doe@example.com', {data: {first_name: 'John'}})
astrotars
06/19/2022, 10:24 PMpg_sodium
extension. The only thing I've been able to find is an announcement and how to enable. Do you happen to know if there are official docs or a tutorial somewhere that could help me out?Bicijay
06/19/2022, 11:52 PM