Fork me on GitHub
#sql
<
2017-12-23
>
jgh03:12:40

what does this error mean: org.postgresql.util.PSQLException: This ResultSet is closed.? I’m trying to just do a basic insert…querying the database works fine, and inserting the value via psql….is this another jdbc sensitivity toward subqueries (one of the fields has a default value of now() :P)

noisesmith03:12:52

my first suspicion is that you used a lazy function on the db results, and the value wasn't forced until the resultset was closed

noisesmith03:12:16

that classic io inside laziness problem

jgh03:12:11

Maybe, this is the function I’m using right now

(defn ^:private add-rule [req]
  (j/insert-multi! (:db conf) :rule [{:team_id 1 :league_id 1 :season_start "2017-12-24" :season_end "2018-12-24"}])
  (common/body-for-404)
)

jgh03:12:32

ring calls that function via POST basically

noisesmith03:12:45

it doesn't seem like anything lazy would be done with that resultset - in fact it doesn't look like anything would bedone with it at all

jgh03:12:21

yeah that was my first thought was maybe I was doing something wrong with the result, so im just trying to do the insert without the result at all

jgh03:12:37

weird…i made a table that is just those four columns + a primary key (bigserial) and i’m still getting that error

jgh03:12:24

i wonder if im using the wrong driver

noisesmith03:12:06

that error should mean that the result set is being closed prematurely before being consumed

jgh03:12:16

i was using the latest postgres on clojars, but looks like it’s from 2014…i just changed it to org.postgresql/postgresql "42.1.4" and now it’s working

jgh03:12:56

so seems like that postgres lib on clojars should be updated or removed because it doesnt seem to work at all for inserts anymore