Re: [HACKERS] Re: Jesus, what have I done (was: LONG)
От | Bruce Momjian |
---|---|
Тема | Re: [HACKERS] Re: Jesus, what have I done (was: LONG) |
Дата | |
Msg-id | 199912122111.QAA08216@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: Jesus, what have I done (was: LONG) (wieck@debis.com (Jan Wieck)) |
Список | pgsql-hackers |
> > I am confused here. With my code, you only have to: > > > > add code to write/read from long tables > > add code to expand long values in varlen access routines > > add code to heap_insert() to move data to long tables > > add code to heap_delete() to invalidate long tuples > > Add code to expand long values in varlen access routines, > you're joking - no? Here is a patch to textout() that allows it to handle long tuples. It checks the long bit, and calls the proper expansion function, and pfree()'s it on exit. It is a minimal amount of code that could be added to all the varlena access routines. I would be glad to do it. By doing it there, we expand only when we access the varlena value, not on every tuple. --------------------------------------------------------------------------- *** varlena.c Sun Nov 7 18:08:24 1999 --- varlena.c.new Sun Dec 12 15:49:35 1999 *************** *** 176,181 **** --- 176,182 ---- { int len; char *result; + bool islong = false; if (vlena == NULL) { *************** *** 184,189 **** --- 185,197 ---- result[1] = '\0'; return result; } + + if (VARISLONG(vlena)) /* checks long bit */ + { + vlena = expand_long(vlena); /* returns palloc long */ + islong = true; + } + len = VARSIZE(vlena) - VARHDRSZ; result = (char *) palloc(len + 1); memmove(result, VARDATA(vlena), len); *************** *** 192,197 **** --- 200,208 ---- #ifdef CYR_RECODE convertstr(result, len, 1); #endif + + if (islong) + pfree(vlena); return result; } -- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610) 853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania19026
В списке pgsql-hackers по дате отправления: