Remove lib/pq usage and rely on pgtype arrays#255
Conversation
|
I don't think this is really feasible because it requires changing all references from sql.X to pgx.X in order such that sqlc can rely on pgx types, meaning it would break for folks using this library. I attempted that here. Is there a reason you are trying to do this? |
|
Hi, thanks for looking. @bplunkett-stripe My reason is simple: I understand the concern about breaking users. I’m not trying to change the public API from If my PR still breaks compatibility, I can adjust it. Would you prefer doing this behind a build tag or only in a major version bump? |
Your PR doesn't work because sqlc still depends on pq's array type. I think we can make your PR work by just encoding it as JSON...in theory, that means sqlc no longer needs the pq type dependency. See my linked PR where I tried to switch to pgx. |
|
Thanks — that makes sense. @bplunkett-stripe I didn’t realize sqlc still depends on pq’s array type, so my PR can’t fully remove the lib/pq dependency in a compatible way. Your idea of encoding the array as JSON (so sqlc no longer needs pq types) sounds like a good direction, and your linked PR looks cleaner. I’m not confident enough to redesign this properly myself, so I’d prefer to follow your approach. |
|
Understood! I'll close this out, but feel free to re-open this PR and ping me if you'd like to make the change. Thanks! |
Description
Motivation
Testing
go test ./...