Re: Composite type: Primary Key and validation

From: Lorusso Domenico <domenico(dot)l76(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Composite type: Primary Key and validation
Date: 2023-06-05 18:19:27
Message-ID: CAJMpnG6Y0kGcaEX6vc-S52OLgn4W760h+kf=LrNEp-G1drdEAw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

thank's Adrian, my problem is I've to use CloudSql, so I can't install
extensions not verified by google...

Il giorno lun 5 giu 2023 alle ore 17:17 Adrian Klaver <
adrian(dot)klaver(at)aklaver(dot)com> ha scritto:

> On 6/5/23 08:06, Lorusso Domenico wrote:
> > Thank's, you are right, I've the same doubts.
> > A composite type is useful because I've to add all these information on
> > many tables and because it more easy to pass all these informations to
> > functions that have to ensure the right format and evaluation.
>
> I do that with a Sqitch(https://sqitch.org/) template, the relevant part
> being:
>
> ...
>
> CREATE TABLE [% IF schema %][% schema %][% ELSE %]schema_name[% END
> %].[% IF table %][% table %][% ELSE %]table_name[% END %](
> line_id integer GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
>
> ts_insert timestamptz NOT NULL DEFAULT now(),
> ts_update timestamptz,
> user_insert varchar(20) NOT NULL DEFAULT "session_user"(),
> user_update varchar(20)
> );
>
> ...
>
> I then add the table specific fields after Sqitch creates the deploy
> script from the template.
>
> >
> > Talking about first point I could use the "table inheritance", but I've
> > to reset all constraints for each table :-(
> >
>
> > --
> > Domenico L.
> >
> > per stupire mezz'ora basta un libro di storia,
> > io cercai di imparare la Treccani a memoria... [F.d.A.]
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
>
>

--
Domenico L.

per stupire mezz'ora basta un libro di storia,
io cercai di imparare la Treccani a memoria... [F.d.A.]

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2023-06-05 18:22:47 Re: Composite type: Primary Key and validation
Previous Message Merlin Moncure 2023-06-05 17:41:59 Re: Composite type: Primary Key and validation