Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lqNQV-0004p3-8k for pgsql-general@arkaria.postgresql.org; Mon, 07 Jun 2021 22:08:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lqNQU-0007dk-8V for pgsql-general@arkaria.postgresql.org; Mon, 07 Jun 2021 22:08:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lqNQT-0007bF-Vl for pgsql-general@lists.postgresql.org; Mon, 07 Jun 2021 22:08:53 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lqNQP-00059r-RT for pgsql-general@lists.postgresql.org; Mon, 07 Jun 2021 22:08:53 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id DFF324802; Tue, 8 Jun 2021 00:08:48 +0200 (CEST) Date: Tue, 8 Jun 2021 00:08:48 +0200 From: "Peter J. Holzer" To: pgsql-general@lists.postgresql.org Subject: Re: index unique Message-ID: <20210607220848.GB17125@hjp.at> Mail-Followup-To: pgsql-general@lists.postgresql.org References: <20210607065501.GA17125@hjp.at> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="neYutvxvOLaeuPCA" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --neYutvxvOLaeuPCA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2021-06-07 10:20:22 -0700, David G. Johnston wrote: > On Sun, Jun 6, 2021 at 11:55 PM Peter J. Holzer 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, w= e need > > 3 columns of that table: > > 1 of type integer, > > 1 of type text, > > 1 of type geometry > > > > creating the PK constraint doesn work: >=20 > I find that if a natural primary key candidate is so complex, it is > usually better to use a surrogate key. >=20 >=20 > 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 --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --neYutvxvOLaeuPCA Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAmC+mOsACgkQ8g5IURL+ KF0kkg/8C7keyTKtA2C0WezjiAXFGfHScRc2jd9KV1zla7C6NMwP2Txz6WpkLHu+ rrfA8l0Est3Uu4sW95zGWloqWl+MWWf/UPj6mYam/OSkacoqROl+Kv1bkVkd80kB TjssGsiW2jLA+CmQ6n+bhko6FzG5JV4YSpCP7aNQBtyeb2I74sKjxCIB6UymVxq8 fXfoRoHie5RWP1oZlf35XD21nbT4iNkSxvbjR3cRMPbaQ6pUt2+q9f2oS91cPQSP Oouxv8kT4nmkVQXcBVMmrs9Qd4r5q7QJxdyaHeXwjf8coFtsLksbSsJNWzEK/rTl ABt8AI+qZp29HJtzwcZtNuHWnySbtyZxTVa6bSZBPk+fcME/N+v8GDiep1AOvuql XPZHRaiiZUuz4fh11nvmXJc3dIGbWsGN8Q4s79ThHuJF2q/w6/3BGldOZfWzosEr bE8K/3b1swdx8JXIPRo5yoMxQDilfikF4t8q/0s7HndruBtEIF6LVreM8Hn6Ko41 x8mgd3xQaQ51Zt7NflQEugvIvYBTdRrYic7+hNNIRs4WJTF5Y0bfroR4KDuDYy2D XZpb7qof9ADzyiLTp/F6aZbMRgTMu2fr3xNZhtixvrDc/isvHABTT2aaFW4gJyzw n8iKEObmXoJ6E+g72egtvizaAo4Ode/UVb4dNmJq+z8IbnrRUL8= =dkbV -----END PGP SIGNATURE----- --neYutvxvOLaeuPCA--