Skip to content

Development Guide Postgres

Austin Bonander edited this page Mar 30, 2020 · 1 revision

There's two main places to get important implementation details for Postgres types:

https://github.com/postgres/postgres/blob/master/src/include/catalog/pg_type.dat

This is the seed data for the pg_catalog.pg_type table which contains the OIDs for built-in types as well as the routines used to [de]serialize them. You want to look for the typreceive and typsend keys for the type; these are the names of functions, usually implemented in C code, used to marshall and unmarshall types for the binary protocol.

https://github.com/postgres/postgres/tree/master/src/backend/utils/adt

This is where a bunch of building-block functions reside for all the built-in types, including stuff like the implementation of arithmetic for the NUMERIC fixed-point decimal type, as well as routines for marshalling and unmarshalling all the built-in types. The latter are usually named [type name]_send and [type name]_receive, respectively.

Clone this wiki locally