How to generate correct mapping that uses PSQL functions as default parameter

23 views
Skip to first unread message

Luca Molteni

unread,
May 5, 2015, 7:08:25 AM5/5/15
to scala...@googlegroups.com
Hi everyone, I'm trying to generate the Scala mapping using a generator on a a database that uses some PSQL function for the default. 

create table my_table(
  id bigserial primary key,
  ts int not null default _now()  
);

where the function _now is defined as

create or replace function _now() returns int language sql stable as 
  'select extract(epoch from now())::int';

I'm getting

[error] (run-main-0) java.lang.NumberFormatException: For input string: "_now()"
java.lang.NumberFormatException: For input string: "_now()"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)
at scala.collection.immutable.StringLike$class.toInt(StringLike.scala:272)
at scala.collection.immutable.StringOps.toInt(StringOps.scala:30)

I understand this kind of behaviour may not be implemented yet, do you know if there's some easy way to skip the processing of that default?

Thanks a lot.
Reply all
Reply to author
Forward
0 new messages