-
Notifications
You must be signed in to change notification settings - Fork 887
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pgtype.Hstore: add a round-trip test for binary and text codecs
This ensures the output of Encode can pass through Scan and produce the same input. This found two two minor problems with the text codec. These are not bugs: These situations do not happen when using pgx with Postgres. However, I think it is worth fixing to ensure the code is internally consistent. The problems with the text codec are: * It did not correctly distinguish between nil and empty. This is not a problem with Postgres, since NULL values are marked separately, but the binary codec distinguishes between them, so it seems like the text codec should as well. * It did not output spaces between keys. Postgres produces output in this format, and the parser now only strictly parses the Postgres format. This is not a bug, but seems like a good idea.
- Loading branch information
Showing
2 changed files
with
67 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters