Hey everyone 🙂 I'm having a weird issue where sup...
# help
a
Hey everyone 🙂 I'm having a weird issue where supabase is returning the incorrect data from my table.. I think it has to do with the
type
I have set for the column, but I'm not sure. Basically, in a table I have
numeric
column set. An example number in this column would be
3458764526524427914
When I retrieve the number (via JS client), I send something like this:
Copy code
const { data, error } = await supabase
    .from("table-name")
    .select()
The returned value for the expected column is returned as
3458764526524428000
You can tell that it's the same number from the first half, but the last 4 digits are rounded up (to
8000
). In fact, this is the case with all of the numbers in my table (returned as rounded numbers) I have also tried this with
int8
as a column type, and it is giving me the same issue. Also interestingly enough, when the column is a
numeric
type, the data/numbers (in the supabase table UI) look correct (but are returned wrong), and when the column is a
int8
type, the data/numbers look incorrect (rounded) in the supabase ui (and are returned incorrectly (rounded) What am I doing wrong??
n
Hello @addisonschultz! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
🆕 numeric and int8 columns are returning incorrect (rounded) values
a
I've tried changing the data type in the table, and also via the SQL editor (setting the numeric precision/scale to the level it should be) Even if the data is accurately represented in the UI of supabase, it never returns correctly when fetched using the
supabase
client It is always rounded??
n
numeric and int8 columns are returning incorrect (rounded) values