Skip to content

fix: generated type of PostgreSQL's interval type in pgx#1852

Closed
d-tsuji wants to merge 0 commit intosqlc-dev:mainfrom
d-tsuji:main
Closed

fix: generated type of PostgreSQL's interval type in pgx#1852
d-tsuji wants to merge 0 commit intosqlc-dev:mainfrom
d-tsuji:main

Conversation

@d-tsuji
Copy link
Contributor

@d-tsuji d-tsuji commented Sep 18, 2022

Fixes #1224

When the driver is github.com/jackc/pgx, it is correct to use pgtype.Interval.

@d-tsuji d-tsuji changed the title fix: string the return value of PostgreSQL's interval type in Go fix: the return value of PostgreSQL's interval type in pgx Nov 3, 2022
@d-tsuji d-tsuji changed the title fix: the return value of PostgreSQL's interval type in pgx fix: generated type of PostgreSQL's interval type in pgx Nov 3, 2022
@d-tsuji
Copy link
Contributor Author

d-tsuji commented Nov 3, 2022

@kyleconroy
I have checked past discussions and only generate as pgtype.Interval type if you are using pgx.

#429

The reason why the interval type in PostgreSQL is pgtype.Interval type is due to the following code

https://github.com/jackc/pgtype/blob/72948465f0b9bf2f74e147370d7b61a7f3726cf0/pgtype.go#L299

ci.RegisterDataType(DataType{Value: &Interval{}, Name: "interval", OID: IntervalOID})

We believe this is sufficient for many use cases. It improves the development experience by allowing users to query without setting overrides.

Are there any other concerns? And is there anything else I can help you with?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parsing intervals fails with invalid syntax

1 participant