Company
Date Published
Author
Oliver Rice
Word count
842
Language
English
Hacker News points
16

Summary

The latest version of Supabase GraphQL, pg_graphql 1.4+, introduces support for Postgres functions, also known as User Defined Functions (UDFs), allowing users to implement custom and complex operations with a simple GraphQL interface. UDFs are reflected in the GraphQL schema and can be used to execute custom SQL logic within GraphQL queries. The feature is based on automatically reflecting parts of the SQL schema, ensuring a coherent GraphQL API from all the information known to the SQL layer. With UDF support, users can create functions that return records, such as searching for accounts based on email domains, and interact with these functions using GraphQL queries. While some features, like overloaded functions and varadic functions, are currently excluded from the API surface area, Supabase plans to implement them in future releases.