postgres icon indicating copy to clipboard operation
postgres copied to clipboard

Add missing postgres types mapping / decoders / parser

Open bombillazo opened this issue 6 months ago • 0 comments

Is your feature request related to a problem? Please describe.

Data returned by the driver is serialized in a string by default. Semantically, some DB types (like cidr, macaddress, text) can stay as strings. However, other data can be represented by a native JS type or a JS data object representing the database value in JS land.

The following is a list of Postgres database type oids, with the unmarked ones indicating a decoder is not yet implemented by deno-postgres. Any unimplemented oid type is returned untouched as a string.

source

  • [x] 16 : bool
  • [x] 17 : bytea
  • [x] 18 : char
  • [x] 19 : name
  • [x] 20 : int8
  • [x] 21 : int2
  • [ ] 22 : _int2vector_0
  • [x] 23 : int4
  • [x] 24 : regproc
  • [x] 25 : text
  • [x] 26 : oid
  • [x] 27 : tid (#228)
  • [x] 28 : xid
  • [ ] 29 : _cid_0
  • [ ] 30 : _oidvector_0
  • [ ] 32 : _pg_ddl_command
  • [ ] 71 : _pg_type
  • [ ] 75 : _pg_attribute
  • [ ] 81 : _pg_proc
  • [ ] 83 : _pg_class
  • [x] 114 : json
  • [ ] 142 : _xml_0
  • [ ] 143 : _xml_1
  • [ ] 194 : _pg_node_tree
  • [x] 199 : json_array (#179)
  • [ ] 210 : _smgr
  • [ ] 325 : _index_am_handler
  • [x] 600 : point (#185)
  • [x] 601 : lseg (#233)
  • [x] 602 : path (#235)
  • [x] 603 : box (#234)
  • [x] 604 : polygon (#236)
  • [x] 628 : line (#232)
  • [x] 629 : line_array (#232)
  • [x] 650 : cidr
  • [x] 651 : cidr_array
  • [ ] 700 : float4 (#444)
  • [x] 701 : float8
  • [ ] 702 : _abstime_0
  • [ ] 703 : _reltime_0
  • [ ] 704 : _tinterval_0
  • [ ] 705 : _unknown
  • [x] 718 : circle (#237)
  • [x] 719 : circle_array (#237)
  • [ ] 790 : _money_0
  • [ ] 791 : _money_1
  • [x] 829 : macaddr
  • [x] 869 : inet
  • [x] 1000 : bool_array (#189)
  • [x] 1001 : byte_array (#189)
  • [x] 1002 : char_array
  • [x] 1003 : name_array
  • [x] 1005 : int2_array
  • [ ] 1006 : _int2vector_1
  • [x] 1007 : int4_array
  • [x] 1008 : regproc_array
  • [x] 1009 : text_array
  • [x] 1010 : tid_array (#228)
  • [x] 1011 : xid_array
  • [ ] 1012 : _cid_1
  • [ ] 1013 : _oidvector_1
  • [x] 1014 : bpchar_array
  • [x] 1015 : varchar_array
  • [x] 1016 : int8_array
  • [x] 1017 : point_array (#185)
  • [x] 1018 : lseg_array (#233)
  • [x] 1019 : path_array (#235)
  • [x] 1020 : box_array (#234)
  • [ ] 1021 : float4_array (#444)
  • [x] 1022 : float8_array (#227)
  • [ ] 1023 : _abstime_1
  • [ ] 1024 : _reltime_1
  • [ ] 1025 : _tinterval_1
  • [x] 1027 : polygon_array (#236)
  • [x] 1028 : oid_array
  • [ ] 1033 : _aclitem_0
  • [ ] 1034 : _aclitem_1
  • [x] 1040 : macaddr_array
  • [x] 1041 : inet_array
  • [x] 1042 : bpchar
  • [x] 1043 : varchar
  • [x] 1082 : date
  • [ ] 1083 : time
  • [x] 1114 : timestamp
  • [x] 1115 : timestamp_array (#229)
  • [x] 1182 : date_array (#231)
  • [x] 1183 : time_array
  • [x] 1184 : timestamptz
  • [x] 1185 : timestamptz_array (#229)
  • [ ] 1186 : _interval_0
  • [ ] 1187 : _interval_1
  • [x] 1231 : numeric_array - parsing to string[] due to limited JS number range (more info)
  • [ ] 1248 : _pg_database
  • [ ] 1263 : _cstring_0
  • [ ] 1266 : timetz
  • [ ] 1270 : timetz_array
  • [ ] 1560 : _bit_0
  • [ ] 1561 : _bit_1
  • [ ] 1562 : _varbit_0
  • [ ] 1563 : _varbit_1
  • [x] 1700 : numeric - parsing to string due to limited JS number range (more info)
  • [ ] 1790 : _refcursor_0
  • [ ] 2201 : _refcursor_1
  • [x] 2202 : regprocedure
  • [x] 2203 : regoper
  • [x] 2204 : regoperator
  • [x] 2205 : regclass
  • [x] 2206 : regtype
  • [x] 2207 : regprocedure_array
  • [x] 2208 : regoper_array
  • [x] 2209 : regoperator_array
  • [x] 2210 : regclass_array
  • [x] 2211 : regtype_array
  • [ ] 2249 : _record_0
  • [ ] 2275 : _cstring_1
  • [ ] 2276 : _any
  • [ ] 2277 : _anyarray
  • [x] 2278 : void
  • [ ] 2279 : _trigger
  • [ ] 2280 : _language_handler
  • [ ] 2281 : _internal
  • [ ] 2282 : _opaque
  • [ ] 2283 : _anyelement
  • [ ] 2287 : _record_1
  • [ ] 2776 : _anynonarray
  • [ ] 2842 : _pg_authid
  • [ ] 2843 : _pg_auth_members
  • [ ] 2949 : _txid_snapshot_0
  • [x] 2950 : uuid
  • [x] 2951 : uuid_array
  • [ ] 2970 : _txid_snapshot_1
  • [ ] 3115 : _fdw_handler
  • [ ] 3220 : _pg_lsn_0
  • [ ] 3221 : _pg_lsn_1
  • [ ] 3310 : _tsm_handler
  • [ ] 3500 : _anyenum
  • [ ] 3614 : _tsvector_0
  • [ ] 3615 : _tsquery_0
  • [ ] 3642 : _gtsvector_0
  • [ ] 3643 : _tsvector_1
  • [ ] 3644 : _gtsvector_1
  • [ ] 3645 : _tsquery_1
  • [x] 3734 : regconfig
  • [x] 3735 : regconfig_array
  • [x] 3769 : regdictionary
  • [x] 3770 : regdictionary_array
  • [x] 3802 : jsonb
  • [x] 3807 : jsonb_array (#179)
  • [ ] 3831 : _anyrange
  • [ ] 3838 : _event_trigger
  • [ ] 3904 : _int4range_0
  • [ ] 3905 : _int4range_1
  • [ ] 3906 : _numrange_0
  • [ ] 3907 : _numrange_1
  • [ ] 3908 : _tsrange_0
  • [ ] 3909 : _tsrange_1
  • [ ] 3910 : _tstzrange_0
  • [ ] 3911 : _tstzrange_1
  • [ ] 3912 : _daterange_0
  • [ ] 3913 : _daterange_1
  • [ ] 3926 : _int8range_0
  • [ ] 3927 : _int8range_1
  • [ ] 4066 : _pg_shseclabel
  • [x] 4089 : regnamespace
  • [x] 4090 : regnamespace_array
  • [x] 4096 : regrole
  • [x] 4097 : regrole_array

Describe the solution you'd like

Implement the missing type Oid parsers. node-pg-types can be used as inspiration for some of the type parsers.

Range types issue is discussed here: #61

If there is an error with the list, like a missing type or a type marked as implemented but not returning the correct JS type, please notify us so it can be updated.

Describe alternatives you've considered

N/A

Additional context

Related issues: #184

bombillazo avatar Feb 05 '24 00:02 bombillazo