Using a composite SQL type in C

Поиск
Список
Период
Сортировка
Искать
От
Dan \Heron\ Myers
Тема
Using a composite SQL type in C
Дата
в 20:29:56
Msg-id
48223B5C.9060109@xnapid.com
Ответ на
Custom Base Type in C (Toby Chavez)
Список
Дерево обсуждения
Custom Base Type in C "Toby Chavez" <odnamr@gmail.com>
Re: Custom Base Type in C Alvaro Herrera <alvherre@commandprompt.com>
Re: Custom Base Type in C "Toby Chavez" <odnamr@gmail.com>
Using a composite SQL type in C "Dan \"Heron\" Myers" <heron@xnapid.com>
Re: Using a composite SQL type in C "Toby Chavez" <odnamr@gmail.com>
Re: Using a composite SQL type in C Dan Myers <heron@xnapid.com>
Re: Custom Base Type in C Dimitri Fontaine <dim@hi-media.com>
Re: Custom Base Type in C "David Wilson" <david.t.wilson@gmail.com>
Re: Custom Base Type in C "Toby Chavez" <odnamr@gmail.com>
I have a type defined in SQL:

CREATE TYPE text_info AS (str text, id integer);

I'd like to use this type as the aggregate type in an aggregate function:

CREATE FUNCTION foobar(text_info,integer,text,text) RETURNS text_info AS 
'$libdir/plugins/mylib.dll', 'foobar' LANGUAGE C;

CREATE AGGREGATE foobar(integer,text,text) (SFUNC = foobar, STYPE = 
text_info);

My problem is, how do I access this type in my function (in C), and how 
do I create a new object of this type to return from the function?  I 
need to store both a text and an int, to avoid doing an extra query 
around the result of this aggregate (to get the corresponding text 
value), which is what I'm currently doing.  Any ideas?

Thanks,
Dan
В списке pgsql-general по дате отправления
От: Alvaro Herrera
Дата:
Сообщение: Re: Custom Base Type in C
От: Toby Chavez
Дата:
Сообщение: Re: Custom Base Type in C
FAQ