Read and write PostgreSQL's time types through their own functions - #160
Merged
estebanzimanyi merged 1 commit intoOct 1, 2026
Merged
Conversation
A PostgreSQL type passed by value, TimestampTz, Timestamp, TimeADT and DateADT, is a class of typeEncodings like a pointer type, its decoder returning it and its encoder taking it without a pointer (timestamptz_in / timestamptz_out). A function taking or returning one states it on the wire through that codec. PostgreSQL's spelling pg_X yields to the name MEOS states it under, X, when both serve a class: timetz_in calls pg_timetz_in, and TimeTzADT and TimeADT read and write through timetz_in/timetz_out and time_in/time_out. A type passed by value that has no codec, Datum, states none. Why. The codec scan read pointer types alone, so every function taking or returning a timestamp, a date or a time had no wire form, and TimeTzADT read through pg_timetz_in, which MEOS does not publish. Measured. Over MobilityDB 72abdf86c2: TimestampTz, Timestamp, TimeADT and DateADT join typeEncodings, their readers taking typmod -1; TimeTzADT moves to timetz_in and timetz_out and every other class keeps its codec; 368 public functions become exposable, 2860 to 3228, and none stops being exposable. The wire of 527 functions changes, each through one of the five types. Read through libmeos with the trailing inputs the catalog states, each type returns its text unchanged: timestamptz_in '2026-10-01 12:34:56.789+02' writes back '2026-10-01 12:34:56.789+02', likewise the other four. Witness. tests/test_enrich.py reads and writes a type passed by value through its functions, states its parameter and result on the wire, prefers timetz_in over pg_timetz_in, registers nothing for a value type without a codec, and over the catalog finds the five codecs; four of the five fail on the code without this change. The suite floor goes from 390 to 395.
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 PostgreSQL type passed by value, TimestampTz, Timestamp, TimeADT and
DateADT, is a class of typeEncodings like a pointer type, its decoder
returning it and its encoder taking it without a pointer
(timestamptz_in / timestamptz_out). A function taking or returning one
states it on the wire through that codec. PostgreSQL's spelling pg_X
yields to the name MEOS states it under, X, when both serve a class:
timetz_in calls pg_timetz_in, and TimeTzADT and TimeADT read and write
through timetz_in/timetz_out and time_in/time_out. A type passed by value
that has no codec, Datum, states none.
Why. The codec scan read pointer types alone, so every function taking
or returning a timestamp, a date or a time had no wire form, and
TimeTzADT read through pg_timetz_in, which MEOS does not publish.
Measured. Over MobilityDB 72abdf86c2: TimestampTz, Timestamp, TimeADT
and DateADT join typeEncodings, their readers taking typmod -1;
TimeTzADT moves to timetz_in and timetz_out and every other class keeps
its codec; 368 public functions become exposable, 2860 to 3228, and none
stops being exposable. The wire of 527 functions changes, each through
one of the five types. Read through libmeos with the trailing inputs the
catalog states, each type returns its text unchanged: timestamptz_in
'2026-10-01 12:34:56.789+02' writes back
'2026-10-01 12:34:56.789+02', likewise the other four.
Witness. tests/test_enrich.py reads and writes a type passed by value
through its functions, states its parameter and result on the wire,
prefers timetz_in over pg_timetz_in, registers nothing for a value type
without a codec, and over the catalog finds the five codecs; four of
the five fail on the code without this change. The suite floor goes
from 390 to 395.