
On Tue, Jul 16, 2024 at 3:47 PM Ruben Perez <rubenperez038@gmail.com> wrote:
Yes! That's it. Actually, the mapping is one of the points I don't see any clearly after reading the protocol spec (and it looks like libpq doesn't solve it either, leaving you just a bunch of bytes/text to interpret). Do you have any ideas or any resources on how to approach the issue?
I found what is done in https://github.com/yandex/ozo inspiring. It creates a compile-time map for standard types with fixed OIDs and a runtime map for user-defined types, retrieving OID numbers from PostgreSQL upon first use. Additionally, it exposes several type traits for specialization, enabling the use of containers and wrapper types for PostgreSQL types like: template <typename ...Ts> struct is_array<std::vector<Ts...>> : std::true_type {}; template <typename T> struct is_nullable<std::optional<T>> : std::true_type {};