MCPcopy
hub / github.com/dbcli/pgcli / register_typecasters

Function register_typecasters

pgcli/pgexecute.py:43–55  ·  view source on GitHub ↗

Casts date and timestamp values to string, resolves issues with out-of-range dates (e.g. BC) which psycopg can't handle

(connection)

Source from the content-addressed store, hash-verified

41
42
43def register_typecasters(connection):
44 """Casts date and timestamp values to string, resolves issues with out-of-range
45 dates (e.g. BC) which psycopg can't handle"""
46 for forced_text_type in [
47 "date",
48 "time",
49 "timestamp",
50 "timestamptz",
51 "bytea",
52 "json",
53 "jsonb",
54 ]:
55 connection.adapters.register_loader(forced_text_type, psycopg.types.string.TextLoader)
56
57
58# pg3: I don't know what is this

Callers 1

connectMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected