RE: AW: AW: [HACKERS] Getting OID in psql of recent insert

Поиск
Список
Период
Сортировка
От Hiroshi Inoue
Тема RE: AW: AW: [HACKERS] Getting OID in psql of recent insert
Дата
Msg-id 001401bf364e$8eff2ca0$2801007e@cadzone.tpf.co.jp
обсуждение исходный текст
Ответ на AW: AW: AW: [HACKERS] Getting OID in psql of recent insert  (Zeugswetter Andreas SEV <ZeugswetterA@wien.spardat.at>)
Список pgsql-hackers
> 
> > They get the location they ask for, or a failure.  Hunting around for
> > the new tuple seems like a real waste, and if someone vacuums, it is
> > gone, no?
> 
> It is probably worse, since they might even get the wrong row, 
> but that's the same in Informix and Oracle.
> 
> In Informix:
> 
> a: selects rowid
> b: updates row, row grows, does not fit in page, is relocated
> c: inserts rows, pysical location of rowid is reused
> a: selects row by rowid, gets differet row --> bummer
>

In my implementation,scan by old(updated) tupleid fails.
For example,
=> create table t (dt int4);CREATE=> insert into t values (1);INSERT 18601 1=> select ctid,* from t;ctid
|dt-----+--(0,1)|1(1 row)
 
=> select * from t where ctid='(0,1)';dt-- 1(1 row)
=> update t set dt=2;UPDATE 1=> select * from t where ctid='(0,1)';dt--(0 rows)


In order to get new tids,I provided functions currtid() and currtid2().
=> select currtid2('t','(0,1)');currtid2--------(0,2)(1 row)
=> select * from t where ctid='(0,2)';dt-- 2(1 row)

Of cource,this function is not effective after vacuum.
If you want to detect the change by vacuum,keep oids together with tids.

Regards.

Hiroshi Inoue
Inoue@tpf.co.jp




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

Предыдущее
От: Oleg Bartunov
Дата:
Сообщение: Re: [HACKERS] lztext.c
Следующее
От: Zeugswetter Andreas SEV
Дата:
Сообщение: AW: AW: [HACKERS] Getting OID in psql of recent insert (; and : o perators)