Re: Removing duplicate rows in table

From: Francisco Olarte <folarte(at)peoplecall(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Removing duplicate rows in table
Date: 2024-09-10 16:03:16
Message-ID: CA+bJJbyxMUJFmZ4r22WZ018GJoZxFn+gr3Ad1y5XY5QkjvXZAQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Rich:

On Tue, 10 Sept 2024 at 17:32, Rich Shepard <rshepard(at)appl-ecosys(dot)com> wrote:
> Only a duplicate problem because when I created this table I didn't make the
> proj_nbr column a PK.

Always report this is if you have future problems, so people know if
it is a case of pilot error or corruption, solutions differ and the
good for ones may harm others.

> > Also, if you do not have any uniqueness criteria consider adding an
> > "id identity" column, it is useful when shit hits the fan.
> Yep. that's what I will do.

Bear in mind the relational model on which relational databases are
modeled needs unique rows ( i.e., no two full rows should be equal on
all fields ). It is not enforced in SQL, but now having it normally
leads to problems. When it cannot be done in any other way, normally
adding an identity column is a cheap way to make them unique. I had
that problem with CDR tables ( it means call detail record, and until
I managed to add circuit identification I had the problem that you can
have two calls from and two the same two numbers with equal start and
end times ) and solved it using an identity column ( added just for
this purpose, after doing it a couple times using ctid in testing, it
is slightly more expensive, but a lot more civilized ).

Francisco Olarte.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2024-09-10 16:38:57 Re: Removing duplicate rows in table
Previous Message Adrian Klaver 2024-09-10 15:45:21 Re: Removing duplicate rows in table