Skip to content
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

Composite Type Support #319

Open
olirice opened this issue Feb 17, 2023 · 3 comments
Open

Composite Type Support #319

olirice opened this issue Feb 17, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@olirice
Copy link
Contributor

olirice commented Feb 17, 2023

Currently columns with composite types are filtered out for queries and mutations. They could be supported as shown below.

Translating from

create type "SemVer" as (
    major int,
    minor int,
    patch int,
    "preRelease" text[],
    "buildMetadata" text[]
); 

To

type SemVer {
  major Int
  minor Int
  patch Int
  preRelease [String]
  metadata [String]
}

Open questions (feel free to discuss below)

  • Should sorting be allowed?
  • Filtering? Filtering on single attribute?
  • How/Should nested composites be allowed?
@olirice olirice added the enhancement New feature or request label Feb 17, 2023
@olirice olirice self-assigned this Feb 17, 2023
@shanna
Copy link

shanna commented May 4, 2023

Support for select, insert and update (query/mutate) would be enough to unblock me. I've been using composite types instead of jsonb (and a schema) to group related fields (addresses, icalendar RRULE and RRULESETS etc) that are typed, structured and tightly coupled 1:1 with the row.

I've never written or seen a nested composite type in the wild though. I'm guessing as JSON support continues to improve in PG we might see more use of composite types as a document store without dumping everything in jsonb? If your document schema is well defined keep the strict parts as nested composite types and keep the unstructured parts as jsonb.

Sorting and filtering would be cool but I can always work around it with stored procedures.

@hchockarprasad
Copy link

Any timeline on this??

@olirice
Copy link
Contributor Author

olirice commented Apr 12, 2024

No exact timeline yet. We're currently working on upsert support

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

No branches or pull requests

3 participants