supabase / postgrest-js

Isomorphic JavaScript client for PostgREST.

Home Page:https://supabase.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

.explain() method always return error

fdgtalk opened this issue ยท comments

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Chaining the .explain() method to a working query, return this error:

error: {
    code: '42883',
    details: null,
    hint: 'No function matches the given name and argument types. You might need to add explicit type casts.',
    message: 'function string_agg(record, unknown) does not exist'
  } 

To Reproduce

Following the official guide:
https://supabase.com/docs/guides/api/rest/debugging-performance

Run this SQL command:

alter role authenticator set pgrst.db_plan_enabled to 'true';
NOTIFY pgrst, 'reload config'; 

Query some data:

const data = await supabase.from('countries').select('*').explain()
console.log(data)

Expected behavior

Response similar to this:

Aggregate  (cost=33.34..33.36 rows=1 width=112)
  ->  Limit  (cost=0.00..18.33 rows=1000 width=40)
        ->  Seq Scan on countries  (cost=0.00..22.00 rows=1200 width=40) 

Additional context

I've tried with /supabase-js & /ssr

A bug in postgrest-js, somehow it's sending an undefined:

Accept: application/vnd.pgrst.plan+text; for="undefined"; options=;

On https://github.com/supabase/postgrest-js/blob/master/src/PostgrestTransformBuilder.ts#L245-L276


PostgREST v12 will also give a better error message for this case.

๐ŸŽ‰ This issue has been resolved in version 1.8.6 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€