Re: Questions on user defined data types

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: a <372660931(at)qq(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Questions on user defined data types
Date: 2018-04-24 12:20:32
Message-ID: CAKFQuwYVh9AyanHr3bnrrvhutzVgCrD66LjhVnspOxqYDWwY9w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Apr 24, 2018 at 4:53 AM, a <372660931(at)qq(dot)com> wrote:

> Hi there:
>
> I want to ask the if I could define an object like type in postgresql, it
> may be better to illustrate with actual examples.
>
> Background information:
>
> 1, I would like to pack group of data into 1 entry of in a table.
>
> 2, The table consist some financial product information including
> names, public data and etc.
>
> 3, Each product need to be valued, and the packed entry contains all
> the assumptions (interest rate, etc.) to perform valuation calculation of
> the products.
>
> Furthermore, for company management purpose, the packed data would have
> the following properties:
>
> 1, Elements of the entry can be easily queried, using SQL;
>
> 2, Change of element value is not allowed by simple update, only using
> pre-complied "methods" functions can update them;
>
> 3, Changes using methods functions would be recorded into a specified
> sub-object called "LOG", which record down update information including
> update times and etc.
>
> I am asking if this could be realized and if yes, how should I do it.
>
>
What you describe seems doable, at least to some ​degree. See the
documentation for:

​CREATE TYPE
CREATE TABLE
CREATE FUNCTION
GRANT

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2018-04-24 13:06:27 Re: rh-postgresql96 vs community postgresql-9.6
Previous Message a 2018-04-24 11:53:01 Questions on user defined data types