https://supabase.com/ logo
#help
Title
# help
a

akshg05

01/02/2022, 7:21 PM
So I'm trying querying a table which has zero rows and trying to check if a record with an ud exists or not. The query is returning data which is neither null nor undefined or an empty array. What does a select query return in Supabase js if it finds no relevant rows. I tried searching the docs but couldn't find much about this.
k

ktosiek

01/02/2022, 7:32 PM
a query that matches no rows should return an empty array as data, plus some metadata
can you show the query and the whole result object? That should help with debugging.
(also, which programming language are you using?)
a

akshg05

01/03/2022, 3:39 AM
I am using Javascript. Actually I'm running it in Cloud functions and am unable to debug with breakpoints due to some reason. Query is const {data} = Supabase.from('tableName') .select() .EQ(aomething) .Limit(1) Console.log(data) Something like this
On printing it's neither null nor undefined or an empty array as expected. What am I missing? I am pretty clueless as what is in data coming in.
Ok I checked now and it's working fine. I am unsure how the same code didn't work previously. Though I recall I did a change on my table prev where my primary key was set to int but I was inserting string primary keys. So I changed it to varchar. May be for this reason my records were not inserting. Btw, after the above code I do a check if any matches returned and do an insert accordingly.