SPI_modifytuple for varchar

From: Alex Guryanow <gav(at)nlr(dot)ru>
To: pgsql-general(at)postgresql(dot)org
Subject: SPI_modifytuple for varchar
Date: 2000-09-18 20:53:21
Message-ID: 437.000919@nlr.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

my query is about using the function SPI_modifytuple for a varchar
field.
I have (for example) a table with a field my_field of type
varchar(100). And I need to create a trigger that adds the phrase
"hello, world" to any value, that user inserts (or updates) in field
my_field. Using SPI_getvalue I can retrive the value that user tries
to insert, I can concatenate this value with my phrase "hello world"
using standard function strcat, but I do not understand what arguments
should I pass to SPI_modifytuple function. Say my_value is the pointer
to the concatenated string:
char *my_value;

If I use the function

SPI_modifytuple( rel, newtuple, 1, attnums, my_value, NULL )

then my backend crashes. Can anybody say what I'm doing wrong or give
me an example of modification of varchar value using SPI_* interface?

Best regards,
Alex

Browse pgsql-general by date

  From Date Subject
Next Message Christian Aberger 2000-09-18 21:33:21 Oracle Conversions Tools
Previous Message Peter Eisentraut 2000-09-18 20:17:55 Re: binary operators on integers