From: | Lorusso Domenico <domenico(dot)l76(at)gmail(dot)com> |
---|---|
To: | pgsql-it-generale(at)lists(dot)postgresql(dot)org |
Subject: | Composite type: Primary Key and validation |
Date: | 2023-06-04 23:06:45 |
Message-ID: | CAJMpnG7UXMpJuQKTRrLJAmv3-akg3zLOc-fM2kGrZddj_AmhrQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-it-generale |
Hello guys,
I've a couple of questions about composite type.
Suppose this composite type:
CREATE TYPE my_type AS (
user_ts_start My_start_timestamp,
user_ts_end My_end_timestamp,
db_ts_start My_start_timestamp,
db_ts_end My_end_timestamp,
audit_record jsonb
);
My_start_timestamp is a domain of timestamp with default as now().
My_end_timestamp is a domain of timestamp with default as infinite
1. May I use user_ts_start and/or db_ts_start has part of Primary Key of
a table that contains a field of my_type?
2. to add an overall check constraint on the entire composite type,
could be a valid approach to create a domain based on my_type and add a
custom function to validate it? (check_my_type(VALUE)). In this way I've a
dominan of composite type that contain others domain... what do you think?
thank's in advance
--
Domenico L.
per stupire mezz'ora basta un libro di storia,
io cercai di imparare la Treccani a memoria... [F.d.A.]
From | Date | Subject | |
---|---|---|---|
Next Message | Lorusso Domenico | 2023-06-05 00:11:31 | Search in historical table |
Previous Message | Ilaria Battiston | 2022-08-03 08:10:54 | Linux Day Milano 2022 |