SPI_modifytuple for varchar

Поиск
Список
Период
Сортировка
От Alex Guryanow
Тема SPI_modifytuple for varchar
Дата
Msg-id 437.000919@nlr.ru
обсуждение исходный текст
Список 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



В списке pgsql-general по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: binary operators on integers
Следующее
От: "Christian Aberger"
Дата:
Сообщение: Oracle Conversions Tools