Search Postgresql Archives

Re: Storing a time interval

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I agree with Michael. Another consideration is how the composite type is going to be handled in the DB layer of your processing code (e.g. node, python, ...).  In the scenario you described it seems unlikely you will be either having multiple columns of that type on your PO table, or using that composite type on a different table, so apart from the 'interest' factor, I'm not seeing any practical benefit.  Composite types are also slightly painful in the change they bring to the way you reference them. For example typically you need to surround the outer column in brackets - e.g. (dates).discount_last_date. If you are using an ORM library, does it know how to deal with that?

Steve

On Sat, Nov 9, 2019 at 8:11 AM Michael Lewis <mlewis@xxxxxxxxxxx> wrote:
CREATE TYPE po_dates AS (
    po_isssued_date        timestamptz,
        discount_last_date     timestamptz,
        net_date               timestamptz
        );

What advantage does combining these three values into a custom composite type give you rather than just storing directly? Are you going to reuse this po_dates type on many tables?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux