Skip to content

Read a point cloud point and patch from their text - #466

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:fix/pointcloud-text-input
Oct 18, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:fix/pointcloud-text-input

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

pcpoint and pcpatch cast from VARCHAR through Pcpoint_in_cast and Pcpatch_in_cast, which read the
hex of the pgPointCloud WKB with MEOS's pcpoint_hex_in and pcpatch_hex_in, the twins of the
pcpoint_hex_out and pcpatch_hex_out of the casts to VARCHAR beside them, as MobilityDB reads the
text of a pcpoint and a pcpatch through pgPointCloud. A text that is no such hex is an error.

Witness: on main 5d3ab06 with the pin advance of #464 (bde7c2f), SELECT setUnionAgg(v)::VARCHAR FROM (VALUES ('0101...0040'::pcpatch), ('0101...0840'::pcpatch)) t(v) ends the process with a segmentation fault in set_make_exp, and
SELECT ('0101...0040'::pcpatch)::VARCHAR answers PCSCHEMA for pcid 808464432 not registered:
with no cast from VARCHAR, DuckDB casts the text as a BLOB, so the value holds the characters of
the hex, 808464432 being 0x30303030, the text "0000"; here both answer MobilityDB's text.

Measured: test/sql/tpcpatch.test and test/sql/tpcpoint.test state two patches and a point read
from their text, and setUnionAgg over the two patches, against the text MobilityDB answers for the
same values, and a text that is no hex refused for each type.

Why: a literal is how a query writes a point cloud value, and without the cast it reads as bytes
no schema describes, which the functions over the value then read as a pgPointCloud header.

pcpoint and pcpatch cast from VARCHAR through Pcpoint_in_cast and Pcpatch_in_cast, which read the
hex of the pgPointCloud WKB with MEOS's pcpoint_hex_in and pcpatch_hex_in, the twins of the
pcpoint_hex_out and pcpatch_hex_out of the casts to VARCHAR beside them, as MobilityDB reads the
text of a pcpoint and a pcpatch through pgPointCloud. A text that is no such hex is an error.

Witness: on main `5d3ab06` with the pin advance of MobilityDB#464 (`bde7c2f`), `SELECT setUnionAgg(v)::VARCHAR FROM (VALUES ('0101...0040'::pcpatch),
('0101...0840'::pcpatch)) t(v)` ends the process with a segmentation fault in set_make_exp, and
`SELECT ('0101...0040'::pcpatch)::VARCHAR` answers `PCSCHEMA for pcid 808464432 not registered`:
with no cast from VARCHAR, DuckDB casts the text as a BLOB, so the value holds the characters of
the hex, 808464432 being 0x30303030, the text "0000"; here both answer MobilityDB's text.

Measured: test/sql/tpcpatch.test and test/sql/tpcpoint.test state two patches and a point read
from their text, and setUnionAgg over the two patches, against the text MobilityDB answers for the
same values, and a text that is no hex refused for each type.

Why: a literal is how a query writes a point cloud value, and without the cast it reads as bytes
no schema describes, which the functions over the value then read as a pgPointCloud header.
@estebanzimanyi
estebanzimanyi merged commit 1b3abbc into MobilityDB:main Oct 18, 2026
9 checks passed
@estebanzimanyi
estebanzimanyi deleted the fix/pointcloud-text-input branch October 18, 2026 16:29
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.

1 participant