© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•13mo ago•
23 replies
𝗠𝗜𝗖𝗞𝗘𝗬

type "geometry" does not exist

Hey all,

I'm new to Supabase and to PostgreSQL so I'm checking out functionality and following tutorials. I was trying to follow the tutorial for the PostGIS Geo queries extensions (https://supabase.com/docs/guides/database/extensions/postgis) and I've followed the tutorial to the letter. As soon as I try to run the following:

create or replace function nearby_restaurants(lat float, long float)
returns table (id public.restaurants.id%TYPE, name public.restaurants.name%TYPE, lat float, long float, dist_meters float)
language sql
as $$
  select id, name, st_y(location::geometry) as lat, st_x(location::geometry) as long, st_distance(location, st_point(long, lat)::geography) as dist_meters
  from public.restaurants
  order by location <-> st_point(long, lat)::geography;
$$;
create or replace function nearby_restaurants(lat float, long float)
returns table (id public.restaurants.id%TYPE, name public.restaurants.name%TYPE, lat float, long float, dist_meters float)
language sql
as $$
  select id, name, st_y(location::geometry) as lat, st_x(location::geometry) as long, st_distance(location, st_point(long, lat)::geography) as dist_meters
  from public.restaurants
  order by location <-> st_point(long, lat)::geography;
$$;


I get this error:

ERROR:  42704: type "geometry" does not exist
LINE 5:   select id, name, st_y(location::geometry) as lat, st_x(location::geometry) as long, st_distance(location, st_point(long, lat)::geography) as dist_meters
ERROR:  42704: type "geometry" does not exist
LINE 5:   select id, name, st_y(location::geometry) as lat, st_x(location::geometry) as long, st_distance(location, st_point(long, lat)::geography) as dist_meters


So far I've tried:
- restarting the project,
- setting the search path to include the schema,
- referencing the full path with
public.geometry
public.geometry
and
postgis.geometry
postgis.geometry
,
- checking that the extension is installed (it is),
- I've spent like an hour trying to get help from the AI but we just keep running in circles...
Help?
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Type "vector" does not exist
SupabaseSSupabase / help-and-questions
6mo ago
type geography does not exist -- suddenly
SupabaseSSupabase / help-and-questions
4y ago
ERROR: 42704: type "extensions.vector" does not exist
SupabaseSSupabase / help-and-questions
4mo ago
Property 'userStorage' does not exist on type 'SupabaseAuthClientOptions'
SupabaseSSupabase / help-and-questions
5mo ago