bento icon indicating copy to clipboard operation
bento copied to clipboard

chore/fix(sql): remove lib/pq in favor of pgx

Open maxtheaxe opened this issue 1 year ago • 6 comments

Draws on this issue (which I ran into myself), in which sql_insert doesn't actually support Postgres array columns. I was left trying to manually escape convoluted strings using regex, and handcraft array literals, which is really brittle.

This is a different approach to the other PR, in which I add pgx as an alternate driver. In this case, as discussed here, I'm replacing lib/pq directly, and adding a shim that retains support for referencing the new postgres driver with postgres. Given that pgx/v4 was already used here, I stuck with that, though obviously you may choose to upgrade to v5.

It doesn't redefine any settings otherwise, just reuses everything from the original postgres driver.


I've run go test on internal/impl/sql and built a docker image, and everything seems to be fully working, at least for my somewhat narrow use case (that in the issue referenced above).

That being said, I would like to state for the record that this was LLM-assisted, though obviously the change is pretty straightforward. I figure it doesn't hurt to mention in case I've missed something obvious.

maxtheaxe avatar Nov 27 '25 11:11 maxtheaxe

Hey @maxtheaxe 👋 Do you still have capacity for this? Otherwise happy for myself (or @jem-davies) to push it over-the-line.

Lmk!

gregfurman avatar Jan 28 '26 17:01 gregfurman

Hey @gregfurman. Sorry for the delay here—been busy. I will try to find time this weekend. If I can't, it's all yours. Apologies for the trouble.

maxtheaxe avatar Jan 29 '26 12:01 maxtheaxe

@maxtheaxe No worries at all! This isn't a blocker for anyone atm, so I just wanted to make sure that you're still keen to finish it off.

TBH I think the library change you proposed is a super neat addition and would love to see it actualised 🙂

gregfurman avatar Jan 29 '26 13:01 gregfurman

I'm definitely still game, it just isn't critical to what I'm doing at work. We're launching very shortly, so I'll do it on my own time. I appreciate you following up here to check in!

maxtheaxe avatar Jan 29 '26 13:01 maxtheaxe

Hey @gregfurman. Sadly, I think I'm probably letting either pride or selfishness get in the way of a good feature here. I still don't have time, but if it becomes a blocker, please don't hesitate to finish without me. If all else fails, eventually I will get to it.

To be clear, I'm not saying I don't still want to do it, I'm just recognizing how long it's dragged on at this point.

maxtheaxe avatar Feb 11 '26 15:02 maxtheaxe

@maxtheaxe Thanks for letting me know! I'll place this back into draft and you can pick it back up when you're ready 🙂

gregfurman avatar Feb 11 '26 23:02 gregfurman