>
> > > > I'm planning to implement a new type of scan,scan by TID.
> > > > It's on TODO * Allow WHERE restriction on ctid.
> > > > First,I want to define an equal operator between TID.
> > >
[snip]
>
> > I would use OIDs for '=' operator between TIDs as follows.
> > 387 for = (tid, tid)
> > 1292 for tideq(tid, tid)
> >
> >
> > Unfortunately,TIDs are changed by UPDATE operations.
> > So we would need some functions in order to get the latest
> > TID of a specified tuple such as
> > currtid(relationid/name, tid) which returns tid.
> > I would provide functions for both relid and relname and
> > use 1293-1294 for OIDs of these functions.
> >
> > Comments ?
> > If there's no objection,I would commit them to the current tree.
>
> Sounds good.
>
I have committed them to the current tree.
Needs initdb.
Now we could enjoy WHERE restriction on ctid as follows.
Unfortunately,the scan is still sequential.
=> create table t1 (dt text);
CREATE
=> insert into t1 values ('data inserted');
INSERT 45833 1
=> select ctid,* from t1;
ctid |dt
-----+----------
(0,1)|data inserted
(1 row)
=> select * from t1 where ctid='(0,1)';
dt
----------
data inserted
(1 row)
=> update t1 set dt='data updated';
UPDATE 1
=> select * from t1 where ctid='(0,1)';
dt
--
(0 rows)
=> select ctid,* from t1 where ctid=currtid2('t1', '(0,1)');
ctid |dt
-----+------------
(0,2)|data updated
(1 row)
Regards.
Hiroshi Inoue
Inoue@tpf.co.jp