Because your table is named drivers and not driver...
# javascript
g
Because your table is named drivers and not driver?
z
Thanks for your @garyaustin - Table is
drivers
but the column name is
driver
in
driver_locations
table which references id column of
drivers
table, thats why I am using the
driver
column. Should I rename the foreign key column to drivers and try?
g
What happens if you put drivers in the select?
z
It errors saying drivers column does not exist.
Weirdly if I just select driver as follows
Copy code
let { data, error, status } = await supabase
        .from('driver_locations')
        .select(id, lat, lng, driver)
then I get the id column only returned but as soon as I try selecting other columns I get null as shown earler
g
Is your foreign key actually pointing to drivers?
z
It is... Just double checking...
g
I always use the foreign table name .... table_name (*) , but it may also work with the fk column.
z
Yes. It is.
Let me try this.
g
Wonder if it did not get into schema cache... try running
NOTIFY pgrst, 'reload schema'
in the SQL window.
z
`let { data, error, status } = await supabase .from('driver_locations') .select(
*
)` produces this
Oh okay. Yeah that could be it. I use supabase and never had this kind of issue but I have renamed and dropped columns etc so that maybe the case... Trying now...
Nope. It didnt fix. Restart the instance?
g
.select('*, drivers(*)')
is how I do it. But I think you're right driver should work also.
z
drivers returns null
g
And there is a row with 1?
z
yes... there is
g
RLS?
z
Oh... Yes.. There is RLS enabled... My bad... Let me disable and try again
Yup. It works now. I am sorry. Not sure how I missed it. Thank you so much for your help and I feel embarrased how I missed it.
Thank you so so so much for your help @garyaustin