Re: Packed short varlenas, what next?

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "PostgreSQL Development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Packed short varlenas, what next?
Date: 2007-03-01 04:33:40
Message-ID: 87649ltwez.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Galy Lee 2007-03-01 04:48:50 Re: Resumable vacuum proposal and design overview
Previous Message Mageshwaran 2007-03-01 04:19:42 Re: POSTGRES WAL