CRamsan
08/15/2024, 3:28 PMinsert()
, the client library will make a select
to return the full record". Is this accurate? In the same example when it shows how to return the record it has to manually call select()
.
And then when I am testing this myself, no matter what I do, I am not able to get the inserted record from the DB. 🥲. Just to be sure I even disabled RLS. I can see the entry being added to the DB but it is not being returned to the client.Jan
08/15/2024, 3:33 PMCRamsan
08/15/2024, 4:01 PMval userRequest = CreateUserEntity(
username = name,
)
val createdUser = postgrest.from(COLLECTION)
.insert(userRequest) {
single()
}
.decodeAs<UserEntity>()
logD(TAG, "User created userId=%S", createdUser.id)
I can see that the row is being added to the DB on each operation, I can see it from the web dashboard. And I also confirmed that I can SELECT from the table, so that seems to indicate not a permissions issue. 🤔
I also tried:
val userRequest = CreateUserEntity(
username = name,
)
val createdUser = postgrest.from(COLLECTION)
.insert(userRequest) {
single()
}
.decodeSingle<UserEntity>()
logD(TAG, "User created userId=%S", createdUser.id)
And in both cases I got an EOF,
kotlinx.serialization.json.internal.JsonDecodingException: Expected start of the object '{', but had 'EOF' instead at path: $
JSON input:
Which tells me I am not getting anything back.
I am currently using client library version 2.5.4-wasm0
and I am testing on a JVM target.Jan
08/15/2024, 4:21 PMsingle()Its
select()
, not single()
CRamsan
08/15/2024, 4:25 PMCRamsan
08/15/2024, 4:28 PMJan
08/15/2024, 4:29 PMThanks for the clarification! It was right on my face and I missed it. Next time I should make sure to get my coffee before starting to work.No problem, can happen to anyone!