Fork me on GitHub
#sql
<
2020-03-14
>
maxp07:03:01

postgresql jdbc driver doest not support primitive array of uuids

1
maxp07:03:30

static {
    ARRAY_CLASS_TO_SUPPORT.put(long[].class, LONG_ARRAY);
    ARRAY_CLASS_TO_SUPPORT.put(int[].class, INT_ARRAY);
    ARRAY_CLASS_TO_SUPPORT.put(short[].class, SHORT_ARRAY);
    ARRAY_CLASS_TO_SUPPORT.put(double[].class, DOUBLE_ARRAY);
    ARRAY_CLASS_TO_SUPPORT.put(float[].class, FLOAT_ARRAY);
    ARRAY_CLASS_TO_SUPPORT.put(boolean[].class, BOOLEAN_ARRAY);
    ARRAY_CLASS_TO_SUPPORT.put(String[].class, STRING_ARRAY);
  }

maxp07:03:42

but that works

maxp07:03:53

(let [ua (into-array String ["a1dfa22e-bce4-4ef0-979f-d64315c88ce5"])]
    (with-open [c (get-connection ...)]
      (jdbc/execute! c ["select * from uuid_test where u = ANY(?::uuid[])" ua]))) 

👍 1
kwladyka19:03:36

thanks, looks better, than mine solution

kwladyka19:03:07

just for my curiosity. Do you know why JDBC doesn’t support UUIDs array @maxp?