diff --git a/packages/core/postgrest-js/src/PostgrestClient.ts b/packages/core/postgrest-js/src/PostgrestClient.ts index a20c9cf9a..6cefadd00 100644 --- a/packages/core/postgrest-js/src/PostgrestClient.ts +++ b/packages/core/postgrest-js/src/PostgrestClient.ts @@ -88,6 +88,10 @@ export default class PostgrestClient< * @param relation - The table or view name to query */ from(relation: string): PostgrestQueryBuilder { + if (!relation || typeof relation !== 'string' || relation.trim() === '') { + throw new Error('Invalid relation name: relation must be a non-empty string.') + } + const url = new URL(`${this.url}/${relation}`) return new PostgrestQueryBuilder(url, { headers: new Headers(this.headers),