Skip to content

Add codec for "aclitem[]" type #58

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

Closed
wants to merge 3 commits into from

Conversation

vitaly-burovoy
Copy link
Contributor

The "aclitem[]" type can't be fetched without a cast. Moreover codec for it can't be (re-)defined from a Python code.
The last commit fixes that by adding a codec.

The second one makes error message (for similar cases) be the same (helped during debugging).
The first one stabilizes generating of "pgtypes.pxi" (to make the last commit be less complex).

Previously the "aclitem" type specified to be transferred in the text mode
because Postgres does not support sending it in the binary mode, but the
"aclitem[]" did not have a support at all.
@1st1
Copy link
Member

1st1 commented Dec 28, 2016

Tests? Why do we need 90806d3 as part of this PR?

@vitaly-burovoy
Copy link
Contributor Author

vitaly-burovoy commented Dec 28, 2016

Tests?

I've just added them, no failures (but I fixed a bug, thank you).

Why do we need 90806d3 as part of this PR?

Because ac0dfe1 is based on it.
The file asyncpg/protocol/pgtypes.pxi is generated by tools/generate_type_map.py, it is unwise to edit it manually.
In fact it does nothing for performance or features, but it allows to change one line in ac0dfe1 in tools/generate_type_map.py and get only three changed line in asyncpg/protocol/pgtypes.pxi after generating it again.
Splitting into two commits helps to check them easer.

If you want to use it separately from this PR, you can move master to this commit (or 3e4e3f1) or even cherry-pick it (them), I'll rebase the other ones.

@vitaly-burovoy vitaly-burovoy force-pushed the aclitem branch 2 times, most recently from d969f90 to ac0dfe1 Compare December 29, 2016 01:45
@elprans
Copy link
Member

elprans commented Dec 31, 2016

IMO we should generalize this into a common array literal parsing function and just add text codecs for types that do not support binary I/O. Ditto for composites and ranges.

@1st1
Copy link
Member

1st1 commented Dec 31, 2016

+1 to what @elprans suggests.

@elprans
Copy link
Member

elprans commented Jan 3, 2017

I merged the first half of this PR. Generic support for text arrays is tracked separately in #60. Thanks!

@elprans elprans closed this Jan 3, 2017
@vitaly-burovoy
Copy link
Contributor Author

Thank you very much!

@vitaly-burovoy vitaly-burovoy deleted the aclitem branch January 6, 2017 08:37
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.

3 participants