4

I have a function defined in postgresql db which return void and makes an update inside the function.

when I do

Await.result(db.run(sqlu"""select function_name()"""), Duration.Inf)

I get this SlickException

Update statements should not return a ResultSet

Is there a way to call a function which returns void without getting this error.

dtksmsl
  • 239
  • 4
  • 14

1 Answers1

1

According to http://slick.lightbend.com/doc/3.0.0/sql.html

sqluexpects a row count, since it returns DBIO[Int], so even if slick would recognize void it probably still would throw an exception. Apparently slick interprets void as ResultSet and so you could give sql a try, which returns a ResultSet and just ignore the returned result:

Await.result(db.run(sql"""select function_name()"""), Duration.Inf)
thwiegan
  • 2,163
  • 10
  • 18