Re: Enforce primary key on every table during dev?
geoff hoffman <geoff@rxmg.com>
From: geoff hoffman <geoff@rxmg.com>
To: marcelo <marcelo.nicolet@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Date: 2018-03-01T20:59:54Z
Lists: pgsql-general
I found this thread very interesting. A pivot table is a perfectly valid use case where a compound unique key on two or more columns performs the same function as a primary key without one. I’m not nearly as familiar with Postgres as I am with MySQL (which is why I recently joined this list)... it may be possible to define a collection of tables as a primary key. But if only a unique key is specified in this case, everyone would still be ok with the result from a logic design standpoint. I think Melvin, way up the thread, had the best answer- be the DBA and have a review process. Don’t let folks go adding tables as they like.