Re: Variable constants ? - Mailing list pgsql-general

From Luca Ferrari
Subject Re: Variable constants ?
Date
Msg-id CAKoxK+7Y=4mOMGf6nefeZHUu8DUEAukL8h5YfJ3xZrOvk1OJ2g@mail.gmail.com
Whole thread Raw
In response to Re: Variable constants ?  (Rich Shepard <rshepard@appl-ecosys.com>)
List pgsql-general
On Thu, Aug 15, 2019 at 11:27 PM Rich Shepard <rshepard@appl-ecosys.com> wrote:
> create table labor_rate_mult (
>    rate                 real primary_key,
>    start_date   date not null,
>    end_date     date
> )

I think the rate should not be the primary key, since that would
prevent keeping the whole history when the value is resetted to a
previous one. Probably here a surrogate key will make the trick.

The range solution is probably a more elegant one.

I would also propose the over-complicated possibility of making an
extension wrapping functions that return each single constant value.
In this way, changing the value means upgrading the extension and is
another way to keep history of changes, but probably is because I
don't like one-raw tables so much.

Luca



pgsql-general by date:

Previous
From: PegoraroF10
Date:
Subject: Re: slow queries on system tables
Next
From: Peter Grman
Date:
Subject: Re: Bad Estimate for complex query with JOINS on subselects and OR inwhere conditions