From: | "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp> |
---|---|
To: | "Zeugswetter Andreas SEV" <ZeugswetterA(at)wien(dot)spardat(dot)at> |
Cc: | <pgsql-hackers(at)postgreSQL(dot)org> |
Subject: | RE: AW: AW: [HACKERS] Getting OID in psql of recent insert |
Date: | 1999-11-24 07:36:02 |
Message-ID: | 001401bf364e$8eff2ca0$2801007e@cadzone.tpf.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)tpf(dot)co(dot)jp
From | Date | Subject | |
---|---|---|---|
Next Message | Zeugswetter Andreas SEV | 1999-11-24 09:24:15 | AW: AW: [HACKERS] Getting OID in psql of recent insert (; and : o perators) |
Previous Message | Oleg Bartunov | 1999-11-24 07:09:04 | Re: [HACKERS] lztext.c |