Re: Packed short varlenas, what next? - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: Packed short varlenas, what next?
Date
Msg-id 87649ltwez.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: Packed short varlenas, what next?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Packed short varlenas, what next?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
"Tom Lane" <tgl@sss.pgh.pa.us> writes:

> FWIW, when I went to bed last night I had hstore and intarray working,
> but was still fooling with ltree.  Didn't get to the others yet.

Thanks, I was getting lost in the gist stuff. 

I've disabled packed varlenas for user-defined data types and find tsearch2
and _int still fail. tsearch2 requires the small patch attached. _int seems to
be unrelated.

To make them work with packed varlenas would require ensuring that they're
always detoasted instead of using GETARG_POINTER. I'll look at that tomorrow.
Er, today.

(It would be nice if we made it possible to define gist indexable data types
without so much copy/pasted code though. These data types are all just
defining some basic operations and then copy/pasting the same algorithms to
implement picksplit and the other index support functions in terms of those
basic operations.)


Index: contrib/tsearch2/ts_cfg.c
===================================================================
RCS file: /home/stark/src/REPOSITORY/pgsql/contrib/tsearch2/ts_cfg.c,v
retrieving revision 1.22
diff -c -r1.22 ts_cfg.c
*** contrib/tsearch2/ts_cfg.c    27 Feb 2007 23:48:06 -0000    1.22
--- contrib/tsearch2/ts_cfg.c    1 Mar 2007 04:19:02 -0000
***************
*** 62,70 ****         ts_error(ERROR, "SPI_execp return %d", stat);     if (SPI_processed > 0)     {
!         prsname = (text *) DatumGetPointer(
!                                            SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1, &isnull)
!             );         oldcontext = MemoryContextSwitchTo(TopMemoryContext);         prsname = ptextdup(prsname);
   MemoryContextSwitchTo(oldcontext);
 
--- 62,68 ----         ts_error(ERROR, "SPI_execp return %d", stat);     if (SPI_processed > 0)     {
!         prsname = DatumGetTextP(SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1, &isnull));
oldcontext= MemoryContextSwitchTo(TopMemoryContext);         prsname = ptextdup(prsname);
MemoryContextSwitchTo(oldcontext);

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Mageshwaran
Date:
Subject: Re: POSTGRES WAL
Next
From: Galy Lee
Date:
Subject: Re: Resumable vacuum proposal and design overview