`InsertId` type for UUIDs

Hello, we use UUIDs as our primary IDs so when running insertInto statements we expected the insertId to be a string, but we are getting a bigint | undefined type. How can we get the correct type?
5 Replies
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
bombillazo
bombillazo10mo ago
so insert doesnt work with tables that use UUIDs as primary id/index? not even if we have generate_uuid_v4() as the default? aaah MySQL, ok, we're using PostgreSQL, might be different...
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
bombillazo
bombillazo10mo ago
Awesome! that works! thank you! Would be a nice feature if insertId automatically typed the id as a string if the Typing specified the ID is a string/UUID 😁
koskimas
koskimas10mo ago
That's not possible. Postgres never returns anything from inserts without a returning clause and Kysely never ever adds anything to the SQL you didn't explicitly ask There's no returning clause unless you call returning There's no select clause unless you call select There's no with statement unless you call with There's no values clause in an insert unless you call values There's no set clause in an update unless you call set There's no where clause unless you call where And so on. You get the gist
Want results from more Discord servers?
Add your server
More Posts