minato_oid (minato v0.18.6)
View SourcePostgreSQL type OIDs and the mapping between an array type and its element type.
OIDs for built-in types are fixed by PostgreSQL and are stable across servers,
so they are compiled in as function clauses rather than read from pg_type at
connection time. User defined types (enums, composites, domains) get OIDs
assigned per database and are not handled here.
OIDs arrive from the server, so every function that takes one is total and
answers undefined for an OID minato has no codec for. Names come from your own
code, so oid/1 has no such escape and raises on a name that does not exist.
Summary
Functions
The array type OID whose elements are the given scalar type OID.
The element type OID of an array type OID.
Whether the OID names an array type minato knows.
The name of a scalar type OID, or of an array OID as {array, Name}.
Every scalar type name minato has a codec for.
The OID of a named scalar type, or of an array type given as {array, Name}.
Types
-type name() ::
bool | bytea | int2 | int4 | int8 | float4 | float8 | numeric | text | varchar | json |
jsonb | uuid | date | time | timestamp | timestamptz.
The name minato uses for a built-in PostgreSQL type.
-type oid() :: non_neg_integer().
Functions
The array type OID whose elements are the given scalar type OID.
Returns undefined when the OID is not a scalar type minato knows.
1> minato_oid:array_oid(25).
1009
The element type OID of an array type OID.
Returns undefined when the OID is not an array type minato knows.
1> minato_oid:element_oid(1009).
25
Whether the OID names an array type minato knows.
The name of a scalar type OID, or of an array OID as {array, Name}.
Returns undefined for any OID minato has no codec for.
1> minato_oid:name(23).
int4
2> minato_oid:name(1016).
{array,int8}
3> minato_oid:name(2249).
undefined
-spec names() -> [name()].
Every scalar type name minato has a codec for.
The OID of a named scalar type, or of an array type given as {array, Name}.
Raises function_clause for a name that is not a name/0, which can only be
a mistake in the calling code.