Skip to content

Using composite types for storing VROOM objects #28

Description

@krashish8

It might be interesting to use composite types (https://blog.crunchydata.com/blog/composite-types) for storing VROOM objects such as time windows. Then, instead of creating a separate table for time windows, it can be used as fields in the same table: time_windows TIME_WINDOW_TYPE[],

DO $$ BEGIN
  CREATE TYPE time_window_type AS (
    open TIMESTAMP,
    close TIMESTAMP
  );
EXCEPTION
  WHEN duplicate_object THEN null;
END $$;

This can later be extended to the integer array for amounts, skills, capacity, etc, and this would also ensure validation.

The only thing is how to read a non-native Postgres type on the C code. Handling types on an extension is more difficult, so this might not be straightforward.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions