On Thu, Dec 01, 2005 at 07:18:10PM -0800, Uwe C. Schroeder wrote:
> Why not have something like the rowid in oracle?
http://www.postgresql.org/docs/8.1/interactive/datatype-oid.html, search
on ctid. And
http://www.postgresql.org/docs/8.1/interactive/ddl-system-columns.html.
From the 2nd URL:
ctid
The physical location of the row version within its table. Note that
although the ctid can be used to locate the row version very
quickly, a row's ctid will change each time it is updated or moved
by VACUUM FULL. Therefore ctid is useless as a long-term row
identifier. The OID, or even better a user-defined serial number,
should be used to identify logical rows.
Though I think that a lazy vacuum can change (well, technically remove)
a ctid. AFAIK, it's not safe to use a ctid outside of the transaction
you got it in. Though come to think about it, I don't think there's any
way to get the ctid of a row you just inserted anyway...
Maybe the docs should be changed to just say that you should never reuse
a ctid outside of the transaction you obtained the ctid in?
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461
In response to
Responses
pgsql-hackers by date
| Next: | From: Tom Lane | Date: 2005-12-02 23:53:46 |
| Subject: Re: strange behavior (corruption?) of large production database |
| Previous: | From: Tom Lane | Date: 2005-12-02 23:44:59 |
| Subject: Re: Spam 508 |
pgsql-general by date
| Next: | From: Gary Horton | Date: 2005-12-02 23:49:47 |
| Subject: Re: createuser ignores stdin in 8.1.0? |
| Previous: | From: Tom Lane | Date: 2005-12-02 23:38:01 |
| Subject: Re: Numeric 508 datatype |