Re: Delete 1 Record of 2 Duplicate Records

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Delete 1 Record of 2 Duplicate Records
Дата
Msg-id 4830.1043975786@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Delete 1 Record of 2 Duplicate Records  (greg@turnstep.com)
Список pgsql-sql
greg@turnstep.com writes:
> If they are truly identical, then you must use the hidden 'oid' column to 
> differentiate the two. No need to peek at the oid, just do this:

> DELETE FROM test WHERE oid = (SELECT oid FROM test WHERE column_id=5 LIMIT 1);

Also, if you're unfortunate enough to have this problem in a table with
no OID column, you can play the same trick with the ctid column, which
always exists (it's the physical location of the tuple).  ctid is
dangerous to use for most purposes, because it's not stable over UPDATE
or VACUUM FULL, but it works perfectly well for this kind of problem.
        regards, tom lane


В списке pgsql-sql по дате отправления:

Предыдущее
От: Oliver Vecernik
Дата:
Сообщение: Re: Converting clarion
Следующее
От: Vernon Wu
Дата:
Сообщение: How to rename and drop a column in pg7.3?