The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
update docker init sql file for pg_graphql
dragarcia7a846ebdd634
diff --git a/docker/volumes/db/init/04-pg-graphql.sql b/docker/volumes/db/init/04-pg-graphql.sqlindex a4929abdbae..58ca67805b3 100644--- a/docker/volumes/db/init/04-pg-graphql.sql+++ b/docker/volumes/db/init/04-pg-graphql.sql@@ -17,13 +17,19 @@ as $$IF server_version >= 14 THENRETURN jsonb_build_object(- 'data', null::jsonb,- 'errors', array['pg_graphql extension is not enabled.']+ 'errors', jsonb_build_array(+ jsonb_build_object(+ 'message', 'pg_graphql extension is not enabled.'+ )+ ));ELSERETURN jsonb_build_object(- 'data', null::jsonb,- 'errors', array['pg_graphql is only available on projects running Postgres 14 onwards.']+ 'errors', jsonb_build_array(+ jsonb_build_object(+ 'message', 'pg_graphql is only available on projects running Postgres 14 onwards.'+ )+ ));END IF;END;@@ -42,13 +48,13 @@ alter default privileges for user supabase_admin in schema graphql_public granton functions to postgres, anon, authenticated, service_role;-- Trigger upon enabling pg_graphql-CREATE OR REPLACE FUNCTION extensions.grant_pg_graphql_access()-RETURNS event_trigger-LANGUAGE plpgsql+create or replace function extensions.grant_pg_graphql_access()+ returns event_trigger+ language plpgsqlAS $func$- DECLARE+DECLAREfunc_is_graphql_resolve bool;- BEGIN+BEGINfunc_is_graphql_resolve = (SELECT n.proname = 'resolve'FROM pg_event_trigger_ddl_commands() AS ev@@ -65,23 +71,30 @@ AS $func$alter default privileges in schema graphql grant all on functions to postgres, anon, authenticated, service_role;alter default privileges in schema graphql grant all on sequences to postgres, anon, authenticated, service_role;+ -- Update public wrapper to pass all arguments through to the pg_graphql resolve funccreate or replace function graphql_public.graphql("operationName" text default null,query text default null,variables jsonb default null,- extensions jsonb default null+ extensions jsonb default null)returns jsonblanguage sqlas $$- SELECT graphql.resolve(query, coalesce(variables, '{}'));+ -- This changed+ select graphql.resolve(+ query := query,+ variables := coalesce(variables, '{}'),+ "operationName" := "operationName",+ extensions := extensions+ );$$;grant select on graphql.field, graphql.type, graphql.enum_value to postgres, anon, authenticated, service_role;grant execute on function graphql.resolve to postgres, anon, authenticated, service_role;END IF;- END;+END;$func$;CREATE EVENT TRIGGER issue_pg_graphql_access ON ddl_command_end WHEN TAG in ('CREATE FUNCTION')@@ -120,13 +133,19 @@ AS $func$IF server_version >= 14 THENRETURN jsonb_build_object(- 'data', null::jsonb,- 'errors', array['pg_graphql extension is not enabled.']+ 'errors', jsonb_build_array(+ jsonb_build_object(+ 'message', 'pg_graphql extension is not enabled.'+ )+ ));ELSERETURN jsonb_build_object(- 'data', null::jsonb,- 'errors', array['pg_graphql is only available on projects running Postgres 14 onwards.']+ 'errors', jsonb_build_array(+ jsonb_build_object(+ 'message', 'pg_graphql is only available on projects running Postgres 14 onwards.'+ )+ ));END IF;END;@@ -138,4 +157,8 @@ $func$;CREATE EVENT TRIGGER issue_graphql_placeholder ON sql_drop WHEN TAG in ('DROP EXTENSION')EXECUTE PROCEDURE extensions.set_graphql_placeholder();-COMMENT ON FUNCTION extensions.set_graphql_placeholder IS 'Reintroduces placeholder function for graphql_public.graphql';\ No newline at end of file+COMMENT ON FUNCTION extensions.set_graphql_placeholder IS 'Reintroduces placeholder function for graphql_public.graphql';++drop extension if exists pg_graphql;+-- Avoids limitation of only being able to load the extension via dashboard+create extension if not exists pg_graphql;\ No newline at end of file