https://kotlinlang.org logo
#exposed
Title
# exposed
o

oshai

03/11/2018, 4:15 PM
I get this error:
... don't have client default values. DB defaults don't support in batch inserts
why is that not supported?
t

tapac

03/11/2018, 8:37 PM
Could you provide full sample to test it?
o

oshai

03/12/2018, 6:30 AM
in my case
create_date
is timestamp (mysql db) with default of current_timestamp
t

tapac

03/14/2018, 7:14 AM
with default of current_timestamp
this
default
is available only in database nor code?
o

oshai

03/14/2018, 7:59 AM
There is a default in the database, if I put default in the code it caused it to have my service startup time as default
so I have to omit that
t

tapac

03/14/2018, 11:23 AM
You can use
defaultExpression(CurrentDateTime)
function on column
🎉 1
o

oshai

03/14/2018, 1:23 PM
so in such case in any update to the row it will update the
create_date
? if that is the case it is not a good solution because I want the row to have the initial value when it was inserted.
t

tapac

03/15/2018, 7:38 AM
I wrote simple test and looks like update ignores
defaultExpression
if that column is absent from update: https://gist.github.com/Tapac/2518c19cbeefc6be6e56cfa850ed18db
o

oshai

03/15/2018, 8:55 AM
Thanks, is there any rule when exactly is it added so I can see in the code and document it?
t

tapac

03/15/2018, 12:37 PM
Looks like defaultExpression never used in updates. In inserts it used when defaultExpression placed on non nullable column which absent from insert statement.
8 Views