Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: switch to using jackc/pgx instead of lib/pq #48607

Closed
jordanlewis opened this issue May 8, 2020 · 5 comments · Fixed by #81943
Closed

cli: switch to using jackc/pgx instead of lib/pq #48607

jordanlewis opened this issue May 8, 2020 · 5 comments · Fixed by #81943
Labels
C-cleanup Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.

Comments

@jordanlewis
Copy link
Member

jordanlewis commented May 8, 2020

Pgx is a more full-featured Postgres driver that allows more customizability and provides access to useful Postgres-protocol-specific things than lib/pq, which is hindered by its implementation of the database/sql interfaces.

It would be really nice to have Pgx's extra features in the SQL shell. For example, implementing a client-side flag to display type OIDs per column would be easy with pgx but impossible with lib/pq.

Pgx has gotten some upgrades recently that are necessary for that example. But, pgx is also a user of Go modules. Dep can't handle this and blows up when you try to add pgx of a newish version to the dependency list.

See PR stripe/stripe-go#1055 - they ran into similar problems with dep and ended up just losing support for dep when they upgraded to Go modules.

Jira issue: CRDB-4310

@jordanlewis jordanlewis added the C-cleanup Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior. label May 8, 2020
@awoods187
Copy link
Contributor

@vy-ton for awareness (this about which driver we use internally)

@jordanlewis
Copy link
Member Author

Update on this: I've made a lot of progress. It's still gated behind Go modules. I landed jackc/pgx#757 which is a requirement for getting our CLI to work as we expect.

@ikgo
Copy link

ikgo commented Sep 7, 2020

Hey, not sure my problem related to the issue, but it related to jackc/pgx.
cockroachdb 20.1.5
r := conn.QueryRow(ctx, "select max(page) from pages")
the error on scan invalid length for int8: 4 returned. the data type in response defined as int8 but only 4 bytes of data returned
for query no error returned on scan
r := conn.QueryRow(ctx, "select cast(max(page) as int4) from pages")

lib/pq handle error internally.

Any thoughts on that?

@vy-ton
Copy link
Contributor

vy-ton commented Jun 2, 2022

@rafiss Does pgx now support GSSAPI? If no, that would affect GSSAPI support with CockroachDB CLI?

@rafiss
Copy link
Collaborator

rafiss commented Jun 2, 2022

pgx does support GSSAPI. however, lib/pq did too, so our CLI already supported it before

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants