pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Questions on user defined data types
2+ messages / 2 participants
[nested] [flat]

* Questions on user defined data types
@ 2018-04-24 11:53 a <372660931@qq.com>
  2018-04-24 12:20 ` Re: Questions on user defined data types David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: a @ 2018-04-24 11:53 UTC (permalink / raw)
  To: pgsql-general

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. 


Thank you so much ~~


Shore

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Questions on user defined data types
  2018-04-24 11:53 Questions on user defined data types a <372660931@qq.com>
@ 2018-04-24 12:20 ` David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: David G. Johnston @ 2018-04-24 12:20 UTC (permalink / raw)
  To: a <372660931@qq.com>; +Cc: pgsql-general

On Tue, Apr 24, 2018 at 4:53 AM, a <372660931@qq.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.

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2018-04-24 12:20 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-04-24 11:53 Questions on user defined data types a <372660931@qq.com>
2018-04-24 12:20 ` David G. Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox