adding multiple postgres interval formats#50
adding multiple postgres interval formats#50huehnerhose wants to merge 2 commits intojackc:masterfrom
Conversation
|
A few thoughts: If you use the binary format you don't have to worry about interval format. But if you need to work with the text format it would be nice to avoid detecting the format each time. I've considered adding adding the server parameters to |
|
Thanks for the input, but: What do you mean by using the binary format? For background, I stumbled in this whole topic because of an scanning error with a differently configured server, using an older version von pgx/pgtype (3.something) If there is a better way omitting the textformat altogether, I am all in! Detecting the text format by not using regex would be great, too ;) |
|
PostgreSQL has two transfer formats for almost all data types: a text format and a binary format. The text format is what you see in pgx uses the binary format by default, so unless the text format is chosen for some reason it should "just work" without any changes. |
Since it's a postgres server side configuration which interval primarily is used (postgres, sql, postgres verbose, iso8601) the pg.Interval has to handle multiple "input" formats.
I needed iso8601 support (fast). That PR is more a POC to determine which format the server uses and implementing a POC-style iso8601 parsing, which only supports secods as resolution.
ToDo here would be: