I am confused about PointerGetDatum among other things

Started by Nonameover 24 years ago3 messagesgeneral
Jump to latest
#1Noname
newsreader@mediaone.net

Hello

I am hacking the full text indexing
c trigger found in contrib to suit my need.
(I am a C idiot having never written any
program in it)

Anyhow I have gotten all I want except
this last feature: to use a column other
than oid.

I have the following added

char *id;
..
colnum=SPI_fnumber(tupdesc,args[2]);
id=SPI_getvalue(rettuple,tupdesc,colnum);

I have also verified that id contains the column
I want by doing
elog(ERROR,id);
and it does

Now the original author uses
Datum values[2];
to insert the data and he has
values[0] = PointerGetDatum(data);
before he does
ret = SPI_execp(*(plan->splan), values, NULL, 0);

So I tried something
values[1]=PointerGetDatum(id);
as well as other variations without that
function.

Thanks in advance for any help

#2Noname
newsreader@mediaone.net
In reply to: Noname (#1)
Re: I am confused about PointerGetDatum among other things

I forgot to say that what gets
inserted into the index table
is not what I want.

Show quoted text

On Tue, Aug 14, 2001 at 11:25:27AM -0400, newsreader@mediaone.net wrote:

Hello

I am hacking the full text indexing
c trigger found in contrib to suit my need.
(I am a C idiot having never written any
program in it)

Anyhow I have gotten all I want except
this last feature: to use a column other
than oid.

I have the following added

char *id;
..
colnum=SPI_fnumber(tupdesc,args[2]);
id=SPI_getvalue(rettuple,tupdesc,colnum);

I have also verified that id contains the column
I want by doing
elog(ERROR,id);
and it does

Now the original author uses
Datum values[2];
to insert the data and he has
values[0] = PointerGetDatum(data);
before he does
ret = SPI_execp(*(plan->splan), values, NULL, 0);

So I tried something
values[1]=PointerGetDatum(id);
as well as other variations without that
function.

Thanks in advance for any help

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

#3Noname
newsreader@mediaone.net
In reply to: Noname (#2)
Re: I am confused about PointerGetDatum among other things

If anyone cares I have figured out how to
do this. I use SPI_getbinval
and it works perfectly