sql 2026-10-13

solved: PEBKAC I wanted to build a etst case where I verify that an insert statement parameter vector is correctly populated as the data has few different formats internally (historical baggage, need to support both). Now, I'm using next-jdbc and PostgreSQL. One column is an enum value which are nicely covered with next-jdbc's https://github.com/seancorfield/next-jdbc/blob/develop/doc/tips-and-tricks.md#working-with-enumerated-types. Now, with a simple (is (= "enum-value-one" value)) I get the following test error (of course)

; expected:
"enum-value-one"

; actual:
#function [clojure.lang.AFunction/1]
The docs say that > That call produces a vector ["fr"] with metadata that implements set-parameter the question that remains is, if I want to perform a simple equality test, how can I get the actual value ("enum-value-one") out of the wrapping as-other? (This could be a #C03S1KBA2 question also)

The metadata is

#:next.jdbc.prepare{set-parameter
                    #function[next.jdbc.types/as-other/fn--32211]}

I tried couple of ways to "call" that fn to no avail

The actual value is created as follows to the insert vector

(defn- kw-to-enum
  "PostgreSQL enum compatible data format"
  [kw]
  (-> kw
      (name)
      (as-other)))

picard-facepalm

Oh my days. (value)

I need either to go home or get more coffee. Oh well..

I'll apologize for that: I really like the idiom of value-or-thunk and probably overuse it 🙂

No worries, this was a great journey into next-jdbc source code and function metadata 😂

sometimes the answes is just too close