From: Peter J. Holzer <hjp-pgsql@hjp.at>
To: pgsql-general@lists.postgresql.org
Subject: Re: index unique
Date: Tue, 8 Jun 2021 00:08:48 +0200
Message-ID: <20210607220848.GB17125@hjp.at> (raw)
In-Reply-To: <CAKFQuwbBZQTLtYRxaJUfGFGj60vmcEYCsxiw3tAj1U12kR3TiA@mail.gmail.com>
References: <CADX_1aYbmMHK4wqHd=p_fGsNMOgEB7oe0BY_9ZTWv3e-TQx+oA@mail.gmail.com>
<20210607065501.GA17125@hjp.at>
<CAKFQuwbBZQTLtYRxaJUfGFGj60vmcEYCsxiw3tAj1U12kR3TiA@mail.gmail.com>
On 2021-06-07 10:20:22 -0700, David G. Johnston wrote:
> On Sun, Jun 6, 2021 at 11:55 PM Peter J. Holzer <hjp-pgsql@hjp.at> wrote:
> On 2021-06-03 22:51:55 +0200, Marc Millas wrote:
> > postgres 12 with postgis.
> > on a table we need a primary key and to get a unique combinaison, we need
> > 3 columns of that table:
> > 1 of type integer,
> > 1 of type text,
> > 1 of type geometry
> >
> > creating the PK constraint doesn work:
>
> I find that if a natural primary key candidate is so complex, it is
> usually better to use a surrogate key.
>
>
> You make this sound like an either-or proposition,
While he is talking about *a* primary key, it should be *the* primary
key. There can be only one (that's why it is the primary key).
There can be several unique keys, though.
> but personally it takes a very exceptional circumstance to forgo
> defining a unique natural key.
True, but not what he's talking about.
hp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
Attachments:
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: hjp-pgsql@hjp.at
Subject: Re: index unique
In-Reply-To: <20210607220848.GB17125@hjp.at>
References: <CADX_1aYbmMHK4wqHd=p_fGsNMOgEB7oe0BY_9ZTWv3e-TQx+oA@mail.gmail.com> <20210607065501.GA17125@hjp.at> <CAKFQuwbBZQTLtYRxaJUfGFGj60vmcEYCsxiw3tAj1U12kR3TiA@mail.gmail.com> <20210607220848.GB17125@hjp.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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