sql

All things SQL and JDBC...
richiardiandrea 2021-03-24T00:14:56.049500Z

Thank you, that worked (as well)

futuro 2021-03-24T14:09:15.050900Z

Is there an option to pass somewhere in next.jdbc to automatically convert JSONB columns from postgres, but that doesn't involve extending the result-set/ReadableColumn protocol?

futuro 2021-03-24T14:10:25.052200Z

We're currently extending that protocol, but I'm wondering if there's a more functional, less protocol based method of achieving the same result of JSONB column values being converted to EDN automatically on SELECT calls

lukasz 2021-03-24T14:11:44.052400Z

Why protocols are a problem?

richiardiandrea 2021-03-27T01:28:42.068400Z

just as additional data point, I have also found the protocol way a bit clunky...plus it's global - that might be a disadvantage, depending of course on what you are doing...not a big deal anyways

futuro 2021-03-24T14:14:33.053800Z

Not a problem, per se, but the side-affecting nature of loading a namespace with protocol extensions has me wondering if there's a way without protocols.

futuro 2021-03-24T14:16:23.055300Z

Specifically, forcing everyone to have json column values parsed in the same way has me wondering about alternatives.

lukasz 2021-03-24T14:27:12.058200Z

The functional alternative is to... have a function which wraps your query functions and parses JSONB columns, right? I'd assume that's less performant though (I might be wrong, I prefer to extend the protocol and not worry about wrapping my functions to properly (de)serialize JSON columns).

futuro 2021-03-24T14:36:00.058800Z

I'm not sure about the performance impact, though I also assume it'd be slower.

futuro 2021-03-24T14:36:20.059200Z

I don't have any data to back that up though.

seancorfield 2021-03-24T16:45:53.060600Z

You could write a builder adapter that applied the conversion and then use default options if you wanted to make that builder your default (for a given datasource). There are caveats, and it’s probably a lot more work, but it is doable.

futuro 2021-03-24T20:49:56.061800Z

That's good to know, thank you. I'll start with protocols and keep that in mind if/when we need to switch away from them.