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

Trying bytea->pcpoint conversion #212

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

The-Alchemist
Copy link
Contributor

The following patch enables code like:

select (decode('0104000000010001', 'hex'))::pcpoint;

Feedback requested.

I was hoping to take advantage of new bytea->pcpoint function as the receive_function, but I'm not quite sure how that works or if I did it right. Any tips suggested. :)

@@ -186,6 +186,10 @@ CREATE OR REPLACE FUNCTION pcpoint_in(cstring)
RETURNS pcpoint AS 'MODULE_PATHNAME', 'pcpoint_in'
LANGUAGE 'c' IMMUTABLE STRICT;

CREATE OR REPLACE FUNCTION pcpoint_in(bytea)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't name this function pcpoint_in. pcpoint_in and pcpoint_out are the pcpoint type's input and output functions, respectively. So I'd rather not add a pcpoint_in function that doesn't participate to the type definition.

So I suggest that we name this function PC_PointFromWKB, which is consistent with PostGIS' ST_GeomFromWKB function.

@elemoine
Copy link
Contributor

See my comment above regarding the function name.

Also, if we add this function and cast for points, I think we should do the same for patches. We'd also need to add docs and tests.

Thanks for the contribution!

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.

2 participants