State every scalar type by its definition, never by the platform's - #155
Merged
estebanzimanyi merged 1 commit intoOct 1, 2026
Conversation
A slot declared by a scalar typedef states what MEOS defines it as, read from the typedef chain of the unit the catalog parses: the parser records every typedef one step down, the C library's and libh3's included. A type PostgreSQL declares in MobilityDB's vendored pgtypes keeps its name: TimestampTz, DateADT, TimeADT, Oid, Datum. Any other integer typedef is stated by the C standard type its chain reaches: int32 is int32_t, int16 is int16_t, H3Index, Quadbin and S2CellId are uint64_t. A chain meeting neither ends at the C scalar it names, float8 at double. libclang's resolution on the host is never the answer: it states TimeADT as long, 32 bits on Windows, and int32 as int. A name defined as its own <stdint.h> name, as PostgreSQL 18's c.h defines the historical names for types in <stdint.h> (typedef int32_t int32), and a name for a C floating type (typedef double float8) name a width and not a type of their own, so the chain goes on through them, whichever header defines them. The other typedefs keep the spelling _TYPE_MAP gives them (Jsonb, GSERIALIZED), and _TYPE_MAP still recovers a name the preprocessor erased to int. The service projection reads the C standard's integer types as integers, as it reads int and long: a parameter or result spelled int64_t, uint64_t, uint32_t, uint8_t or size_t is a JSON integer. Why. Bindings key on canonical. A binding that read TimeADT as long read 32 bits on Windows, one that read uint64_t never met the int32 of the same header spelled the same way, and every typedef missing from a hand list reached the bindings as whatever libclang made of it on the host. The chain leaves no list to complete: a new typedef is stated by its definition. Measured. Over MobilityDB 72abdf86c2, whose pg_basetypes.h defines int8 to uint64 as PostgreSQL 18's c.h does, 557 slots change: 258 int32, 111 int16 and 77 int32_t slots read int32_t and int16_t for int and short, 35 uint8_t read uint8_t for unsigned char, 73 TimeADT read TimeADT for long, and 3 Oid read Oid for unsigned int. 368 functions taking or returning a C standard integer enter the service projection, 2516 exposable becoming 2860; 23 time functions and text_cmp leave it, TimeADT and Oid joining the TimestampTz and DateADT the projection maps to no wire type. Witness. tests/test_typerecover.py follows the chains of a width name, a cell, a PostgreSQL type, Datum over uintptr_t, a width name spelled as no <stdint.h> type, a float and a name no scalar; reads PostgreSQL's names from every scalar typedef of a pgtypes tree, whichever header declares it, without its structs and pointers; and states a slot by its chain. Over the catalog, no slot declared by a typedef reads as a C integer, and TimeADT, DateADT, int32 and uint8_t slots read their definition. tests/test_enrich.py reads int64_t, int32_t and uint32_t as JSON integers. The suite floor goes from 343 to 354.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A slot declared by a scalar typedef states what MEOS defines it as, read
from the typedef chain of the unit the catalog parses: the parser records
every typedef one step down, the C library's and libh3's included. A type
PostgreSQL declares in MobilityDB's vendored pgtypes keeps its name:
TimestampTz, DateADT, TimeADT, Oid, Datum. Any other integer typedef is
stated by the C standard type its chain reaches: int32 is int32_t, int16
is int16_t, H3Index, Quadbin and S2CellId are uint64_t. A chain meeting
neither ends at the C scalar it names, float8 at double. libclang's
resolution on the host is never the answer: it states TimeADT as long,
32 bits on Windows, and int32 as int.
A name defined as its own <stdint.h> name, as PostgreSQL 18's c.h
defines the historical names for types in <stdint.h> (typedef int32_t
int32), and a name for a C floating type (typedef double float8) name a
width and not a type of their own, so the chain goes on through them,
whichever header defines them. The other typedefs keep the spelling
_TYPE_MAP gives them (Jsonb, GSERIALIZED), and _TYPE_MAP still recovers a
name the preprocessor erased to int.
The service projection reads the C standard's integer types as integers,
as it reads int and long: a parameter or result spelled int64_t, uint64_t,
uint32_t, uint8_t or size_t is a JSON integer.
Why. Bindings key on canonical. A binding that read TimeADT as long read
32 bits on Windows, one that read uint64_t never met the int32 of the
same header spelled the same way, and every typedef missing from a hand
list reached the bindings as whatever libclang made of it on the host.
The chain leaves no list to complete: a new typedef is stated by its
definition.
Measured. Over MobilityDB 72abdf86c2, whose pg_basetypes.h defines int8
to uint64 as PostgreSQL 18's c.h does, 557 slots change:
258 int32, 111 int16 and 77 int32_t slots read int32_t and int16_t for
int and short, 35 uint8_t read uint8_t for unsigned char, 73 TimeADT read
TimeADT for long, and 3 Oid read Oid for unsigned int. 368 functions
taking or returning a C standard integer enter the service projection,
2516 exposable becoming 2860; 23 time functions and text_cmp leave it,
TimeADT and Oid joining the TimestampTz and DateADT the projection maps
to no wire type.
Witness. tests/test_typerecover.py follows the chains of a width name, a
cell, a PostgreSQL type, Datum over uintptr_t, a width name spelled as no
<stdint.h> type, a float and a name no scalar; reads PostgreSQL's names
from every scalar typedef of a pgtypes tree, whichever header declares
it, without its structs and pointers; and states a slot by its chain.
Over the catalog, no slot declared by a typedef reads as a C integer, and
TimeADT, DateADT, int32 and uint8_t slots read their definition.
tests/test_enrich.py reads int64_t, int32_t and uint32_t as JSON
integers. The suite floor goes from 343 to 354.