supabase-js icon indicating copy to clipboard operation
supabase-js copied to clipboard

Newly added column doesn't exist on update, but when I fetch, it's visible

Open basedonskills opened this issue 1 year ago • 4 comments

Describe the bug

I've added a new column to my users table named "onboarded". But when I try to update the column it says it doesn't exist. When I fetch the user before the update I see the column being FALSE. Updating the user without this column (updating other columns instead) works without an issue..

Expected behavior

The column exists in the database as well as when I fetch the user. I expect to be able to update it.

Screenshots

Screenshot 2024-03-19 at 22 42 39 Screenshot 2024-03-19 at 22 43 12

System information

  • "supabase": "1.150.0",
  • "@supabase/supabase-js": "2.39.8",

basedonskills avatar Mar 19 '24 21:03 basedonskills

Check if these two SQL functions exist:

  • extensions.pgrst_ddl_watch
  • extensions.pgrst_drop_watch

Some migration tools might somehow drop those functions that are required for the JS client to be up2date with the db.

steve-chavez avatar Apr 04 '24 18:04 steve-chavez

I think I have a similar issue. I added a column, and console.log(profile.added_column) returns undefined, but console.log(profile) returns properly with added_column in it.

Integerous avatar May 26 '24 02:05 Integerous

Experiencing the same, inserting to a new column says: Error updating resume: { code: "PGRST204", details: null, hint: null, message: "Column 'new_url' of relation 'hc_resumes' does not exist", }

but selecting from Table editor works fine.

Domogo avatar Jun 24 '24 10:06 Domogo

Check the above comment https://github.com/supabase/supabase-js/issues/989#issuecomment-2037892631

A temporary workaround is to manually do:

NOTIFY pgrst, 'reload schema';

steve-chavez avatar Jun 24 '24 16:06 steve-chavez

Hi, is there any aupdate on this, I have the same issue, I tried NOTIFY pgrst, 'reload schema'; but It doesnt work Running supabase self hosted.

franciscoq3 avatar Sep 13 '24 14:09 franciscoq3

I think I got the related issue but with SELECT Posted on Supabase Reddit https://www.reddit.com/r/Supabase/comments/1fnbrvs/adding_a_new_column_to_an_existing_table_leads_to/

k0rean-rand0m avatar Sep 23 '24 03:09 k0rean-rand0m

Thanks for sharing @k0rean-rand0m. So it appears this is a NextJS caching issue:; https://www.reddit.com/r/Supabase/comments/1fnbrvs/comment/loi3xjd/.

Will close now as it's not related to supabase-js or postgREST.

steve-chavez avatar Sep 23 '24 17:09 steve-chavez