Devowl
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?Needle
06/19/2022, 1:32 PMDevowl
06/19/2022, 1:35 PMNOTIFY pgrst, 'reload schema';
but it did not solve the problemDevowl
06/19/2022, 1:39 PMgaryaustin
06/19/2022, 1:41 PMDevowl
06/19/2022, 1:41 PMdart
final response = await supabase
.rpc('getDepotStats')
.withConverter((data) => ModelConverter.modelList(
data, (singleElement) => DataDepot.fromJson(singleElement)))
.execute();
Devowl
06/19/2022, 1:43 PMgaryaustin
06/19/2022, 1:43 PMgaryaustin
06/19/2022, 1:43 PMDevowl
06/19/2022, 1:44 PMDevowl
06/19/2022, 1:44 PMgaryaustin
06/19/2022, 1:44 PMDevowl
06/19/2022, 1:45 PMDevowl
06/19/2022, 1:45 PMDevowl
06/19/2022, 1:45 PMDevowl
06/19/2022, 1:45 PMDevowl
06/19/2022, 1:46 PMNeedle
06/19/2022, 1:49 PM