From: | Denis Perchine <dyp(at)perchine(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Problem with updating system indices. |
Date: | 2000-07-30 08:18:26 |
Message-ID: | 00073015263301.28220@dyp.perchine.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello,
Sometime ago I did a patch to have large objects rollbackable.
That patch was against the current (on that moment) CVS.
It worked fine.
Now I tried to port the patch to 7.0.2 and have the following problem:
Somehow index which I made is not updated.
It can be figure out quite simple.
After creating new LO I have:
webmailstation=> explain select * from pg_largeobject where loid=14035719;
NOTICE: QUERY PLAN:
Seq Scan on pg_largeobject (cost=0.00..0.00 rows=1 width=20)
EXPLAIN
webmailstation=> select * from pg_largeobject where loid=14035719;
loid | pageno | data
----------+--------+------
14035719 | 0 |
(1 row)
webmailstation=> set enable_seqscan=off;
SET VARIABLE
webmailstation=> explain select * from pg_largeobject where loid=14035719;
NOTICE: QUERY PLAN:
Index Scan using pg_largeobject_loid_pn_index on pg_largeobject (cost=0.00..5.01 rows=1 width=20)
EXPLAIN
webmailstation=> select * from pg_largeobject where loid=14035719;
loid | pageno | data
------+--------+------
(0 rows)
As far as you can see index does not contains such value.
The code which creates a LO looks like this:
Oid LargeobjectCreate(Oid loid) {
Oid retval;
Relation pg_largeobject;
HeapTuple ntup = (HeapTuple) palloc(sizeof(HeapTupleData));
Relation idescs[Num_pg_index_indices];
Datum values[Natts_pg_largeobject];
char nulls[Natts_pg_largeobject];
int i;
for (i=0; i<Natts_pg_largeobject; i++) {
nulls[i] = ' ';
values[i] = (Datum)NULL;
}
i = 0;
values[i++] = ObjectIdGetDatum(loid);
values[i++] = Int32GetDatum(0);
values[i++] = (Datum) _byteain(NULL, 0);
pg_largeobject = heap_openr(LargeobjectRelationName, RowExclusiveLock);
ntup = heap_formtuple(pg_largeobject->rd_att, values, nulls);
retval = heap_insert(pg_largeobject, ntup);
if (!IsIgnoringSystemIndexes()) {
CatalogOpenIndices(Num_pg_largeobject_indices, Name_pg_largeobje
CatalogIndexInsert(idescs, Num_pg_largeobject_indices, pg_largeo
CatalogCloseIndices(Num_pg_largeobject_indices, idescs);
}
heap_close(pg_largeobject, RowExclusiveLock);
heap_freetuple(ntup);
CommandCounterIncrement();
return retval;
}
And all go fine and indices should be updated... What I did wrong???
I traces through this code step by step and all seems fine...
--
Sincerely Yours,
Denis Perchine
----------------------------------
E-Mail: dyp(at)perchine(dot)com
HomePage: http://www.perchine.com/dyp/
FidoNet: 2:5000/120.5
----------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Robinson | 2000-07-30 08:51:42 | Re: in |
Previous Message | Mike Mascari | 2000-07-30 05:05:51 | Re: Off topic 'C' question |