/usr/lib/python3/dist-packages/postgresql/types/io/builtins.py is in python3-postgresql 1.1.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | from .. import \
INT2OID, INT4OID, INT8OID, \
BOOLOID, BYTEAOID, CHAROID, \
ABSTIMEOID, FLOAT4OID, FLOAT8OID, \
TEXTOID, BPCHAROID, NAMEOID, VARCHAROID
from . import lib
bool_pack = {True:b'\x01', False:b'\x00'}.__getitem__
bool_unpack = {b'\x01':True, b'\x00':False}.__getitem__
int2_pack, int2_unpack = lib.short_pack, lib.short_unpack
int4_pack, int4_unpack = lib.long_pack, lib.long_unpack
int8_pack, int8_unpack = lib.longlong_pack, lib.longlong_unpack
bytea_pack = bytes
bytea_unpack = bytes
char_pack = bytes
char_unpack = bytes
oid_to_io = {
BOOLOID : (bool_pack, bool_unpack, bool),
BYTEAOID : (bytea_pack, bytea_unpack, bytes),
CHAROID : (char_pack, char_unpack, bytes),
INT2OID : (int2_pack, int2_unpack, int),
INT4OID : (int4_pack, int4_unpack, int),
INT8OID : (int8_pack, int8_unpack, int),
ABSTIMEOID : (lib.long_pack, lib.long_unpack, int),
FLOAT4OID : (lib.float_pack, lib.float_unpack, float),
FLOAT8OID : (lib.double_pack, lib.double_unpack, float),
}
# Python Representations of PostgreSQL Types
oid_to_type = {
BOOLOID: bool,
VARCHAROID: str,
TEXTOID: str,
BPCHAROID: str,
NAMEOID: str,
# This is *not* bpchar, the SQL CHARACTER type.
CHAROID: bytes,
BYTEAOID: bytes,
INT2OID: int,
INT4OID: int,
INT8OID: int,
FLOAT4OID: float,
FLOAT8OID: float,
}
|