Skip to content

Add many, many missing types to PostgresDataType #371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 2, 2023

Conversation

gwynne
Copy link
Member

@gwynne gwynne commented Jun 2, 2023

IMPORTANT: This PR only deals with defining the well-known OIDs for Postgres built-in types. Except for adding more array/element type mappings, it does NOT add any additional support for any of these types, not even basic encoding and decoding! That support will be a separate PR.

Including but not limited to:

  • Several geometry types (lseg, path, box, polygon, line)
  • The reg* types (regclass, regtype, etc.)
  • Missing network address types (macaddr8, inet, cidr)
  • Array types for both existing and other new types
  • bit and bit varying
  • The pseudo-types (cstring, internal, any, anycompatible, etc.)
  • The text search types (tsvector, tsquery)
  • Missing range types (numrange, tsrange, tstzrange, daterange)
  • jsonpath
  • The multirange types (int4multirange, nummultirange, etc.)
  • Some special-purpose types (tid, xid, cid, xid8, pg_lsn, trigger, etc.)

Also adds full two-way mappings for every known array type (including existing ones that were missing the mapping, like money).

Requires minor version bump (adds new public API and deprecates PostgresDataType.pgNodeTree)

…including geometry types, the reg* types, network address types, many missing array types, bit and varbit, the pseudo-types, text search types, more range types, jsonpath, and the multirange types.
@gwynne gwynne added the enhancement New feature or request label Jun 2, 2023
@gwynne gwynne requested a review from fabianfett June 2, 2023 12:53
Copy link
Collaborator

@fabianfett fabianfett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a comment where the source of truth is?

@gwynne
Copy link
Member Author

gwynne commented Jun 2, 2023

Can we add a comment where the source of truth is?

The source of truth I used is the actual pg_type table in a fresh database as it appears in my installation of Postgres 15, with a bunch of "really internal" types removed by eye; there's not really any one place to point for truth other than the Postgres docs.

@codecov-commenter
Copy link

codecov-commenter commented Jun 2, 2023

Codecov Report

Merging #371 (fe83e88) into main (fcb2e66) will increase coverage by 0.32%.
The diff coverage is 54.91%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #371      +/-   ##
==========================================
+ Coverage   42.98%   43.30%   +0.32%     
==========================================
  Files         118      118              
  Lines        8243     8484     +241     
==========================================
+ Hits         3543     3674     +131     
- Misses       4700     4810     +110     
Impacted Files Coverage Δ
Sources/PostgresNIO/Data/PostgresDataType.swift 56.19% <54.91%> (-4.19%) ⬇️

@gwynne gwynne merged commit f1744c8 into main Jun 2, 2023
@gwynne gwynne deleted the add-missing-psql-type-codes branch June 2, 2023 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants