Re: FW: Re: FW: Re: Shouldn;t this trigger be called?

From: Michael Lewis <mlewis(at)entrata(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: stan <stanb(at)panix(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: FW: Re: FW: Re: Shouldn;t this trigger be called?
Date: 2019-09-19 21:54:40
Message-ID: CAHOFxGrZqPDOTheMT+kMb2sUSvg7SiFvr=d2-gugwxBr_mMDaw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You can also look at citext type to avoid the casting.

customer_key integer DEFAULT
nextval('customer_key_serial') PRIMARY KEY ,
cust_no smallint NOT NULL UNIQUE ,
name varchar UNIQUE ,

Why do you have a surrogate primary key generated by a sequence when you
have a natural key of either cust_no or name? Why not just declare the
customer number to be the PK? Where does customer number come from anyway?
Using smallint seems potentially short-sighted on potential future growth,
but changing the type later should be minimal work as long as you don't
have this customer_number denormalized many places, or use it as the FKey
after dropping customer_key surrogate key.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2019-09-19 21:55:27 Re: is it safe to drop 25 tb schema with cascade option?
Previous Message Adrian Klaver 2019-09-19 21:49:48 Re: is it safe to drop 25 tb schema with cascade option?