| От | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера