question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when deleting record by UUID: "invalid input syntax for type bigint"

See original GitHub issue

Bug report

Describe the bug

I’m unable to delete a record by its UUID (v4) from the JS SDK.

I call the function as described here

await supabase.from("objectives").delete().eq("id", "7AD4D995-DBE8-4BB6-B40E-02459086A24D");

The URL generated is: https://<...>.supabase.co/rest/v1/objectives?id=eq.7AD4D995-DBE8-4BB6-B40E-02459086A24D

The error is: invalid input syntax for type bigint: "7AD4D995-DBE8-4BB6-B40E-02459086A24D"

I don’t see what this has to do with a bigint, the field is defined as UUID 🤔

I also tried to change the id field type from uuid to text but I get the same error.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Create a table with the id column configured as UUID
  2. Add a row with a custom UUID (v4)
  3. Call supabase.from('your_table').delete().eq('id', 'your_v4_uuid')
  4. See error

Expected behavior

The item should be deleted without error.

Screenshots

Here is the configuration of the field.

Supabase Delete Error

System information

  • OS: macOS
  • Browser: Latest Edge
  • Version of supabase-js: 2.1.3
  • Version of Node.js: 16.17.0

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ByScriptscommented, Dec 9, 2022

It does return “uuid”.

So i made somes tests:

  1. Create a new table “objective_new” with ID as UUID => ✅
  2. Duplicate “objectives” table + entries to “objectives_duplicate” => ✅ 🤔
  3. Rename “objectives” to “objectives_renamed” => ✅ 🤯
  4. Renamed “objective_duplicate” to “objectives” => 🚫
  5. Delete “objectives” then created a new “objectives” table => 🚫

Conclusion: The problem is not the table itself… it’s the table name (at least on my project).

I’ll file a ticket. Thank you for your time.

0reactions
steve-chavezcommented, Dec 9, 2022

There’s no assumption of bigint(or any type) on the postgREST/postgrest-js side.

Conclusion: The problem is not the table itself… it’s the table name (at least on my project).

Seeing that those duplicated names look alike, it could be that you did select on an old table that had the id as bigint and did update on a new one.

Will close this for now but if you can provide a reproduction(with a sample CREATE TABLE..) we’ll reopen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ERROR: invalid input syntax for type uuid on wrong column ...
Oddly if the first field (the actual uuid ) is not a valid uuid it complains about that field. And I only have...
Read more >
Failed to run sql query: invalid input syntax for type uuid - GitHub
I get it while using the UI on the basic plan of Supabase, exactly when I try to "view data" of a foreign...
Read more >
Postgres support for UUID [closed]
My understanding is that Postgres supports UUID data type out-of-the-box. I'm running Postgres on Amazon RDS with Engine version 10.6 and am ...
Read more >
Getting more with PostgreSQL purpose-built data types - AWS
The following steps delete the row with the invalid UUID and change the ... 'John Smith', now()); ERROR: invalid input syntax for type...
Read more >
BUG #17139: Invalid input syntax for uuid (politely this time!)
In my case it was a bad copy/paste of a UUID (missing the first two characters). When I saw there was an error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found