I'm running into an issue that I believe is a bug. I'm using the "Update a record, or create a new record if it doesn't exist" (Upsert) feature on a Posgres table that has an auto incremented primary key.
The primary key (id, int) is what i'm using to filter the table. When the id is not found and the record should be created, retool passes in "NULL" as the id.
As of right now the query running is
INSERT INTO "foo" ("id", "name") values (NULL, "TEST")
Please correct me if I'm wrong, but I believe the expected be behavior should be one of the following:
- Do not pass in "filter by" fields when inserting a record
-- Example INSERT INTO "foo" ("name") values ("TEST")
- Allow for the "DEFAULT" keyword on insert/update (see example below)
-- Example INSERT INTO "foo" ("id", "name") values (DEFAULT, "TEST")
- (complex) recognize that the type is "serial" and look at the nex_val
Any help would be appreciated! For now, we'll just create two queries (update and create) and avoid upsert. Thanks!