petropavel13 / pg_rrule

RRULE data type for PostgreSQL
MIT License
164 stars 29 forks source link

RRULE type cannot be stored #20

Open Natureshadow opened 4 months ago

Natureshadow commented 4 months ago

Storing RRULEs in their compiled form leads to segmentation faults upon retrieval. This happens due to the icalrecurrencetype having an icaltimetype field, which in turn has a pointer to icaltimezone:

https://github.com/Marketcircle/libical/blob/4272d2f81851a37bb08d9ac977a2f672b54e2a20/src/libical/icaltime.h#L136

For obvious reasons, structs with pointers cannot be safely stored in Postgres heap files.

I don't know of any way to prevent a type from being stored, but maybe this should be documented with a huge red flag.

thomastthai commented 1 month ago

What about using a custom storage format for RRULEs to address the struct with pointer issues, like:

For example, some highlights (thanks AI) for how Protocol Buffers provides a workaround: