Error function st_geogfromtext(text) does not exist
occurs with postgis and rpc
#1048
-
I am creating a geo based video sharing app. To achieve this, I have enabled postgis on my project, and I have the following table with location being the geo point. create table if not exists public.videos (
id uuid not null primary key DEFAULT uuid_generate_v4 (),
user_id uuid references public.users not null,
created_at timestamp with time zone default timezone('utc' :: text, now()) not null,
url text,
image_url text,
thumbnail_url text,
gif_url text,
description varchar(320),
location geography(POINT)
); I also defined function to retrieve videos from the above table like this: create or replace function nearby_videos(location text)
returns table(id uuid, image_url text, thumbnail_url text, gif_url text, location geography(POINT))
as
$func$
select id, image_url, thumbnail_url, gif_url, location
from videos
order by videos.location <-> ST_GeogFromText($1)
limit 20;
$func$
language sql; Now when I execute the following query in my SQL editor inside my project's console, I am successfully able to get the video data without any errors.
But when I call the function from my Flutter app, like this, I get the following error: final res = await supabaseClient.rpc('nearby_videos', params: {'location': 'POINT(37.611100 55.756926)'}).execute();
Does anyone know what I could be missing here? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Check this issue supabase/postgrest-js#168. New projects won't have this error. You can work around it by using |
Beta Was this translation helpful? Give feedback.
Check this issue supabase/postgrest-js#168.
New projects won't have this error.
You can work around it by using
extensions.ST_GeogFromText
.