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

Using composite types for storing VROOM objects #28

Open
krashish8 opened this issue Dec 21, 2021 · 0 comments
Open

Using composite types for storing VROOM objects #28

krashish8 opened this issue Dec 21, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@krashish8
Copy link
Member

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.

@krashish8 krashish8 added the enhancement New feature or request label Dec 21, 2021
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

1 participant