Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql General > Using a composi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 9 Topic 15486 of 17437
Post > Topic >>

Using a composite SQL type in C

by heron@[EMAIL PROTECTED] ("Dan \"Heron\" Myers") May 7, 2008 at 05:29 PM

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

-- 
Sent via pgsql-general mailing list (pgsql-general@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
 




 9 Posts in Topic:
Custom Base Type in C
odnamr@[EMAIL PROTECTED]   2008-05-07 17:06:40 
Re: Custom Base Type in C
david.t.wilson@[EMAIL PRO  2008-05-07 19:12:56 
Re: Custom Base Type in C
alvherre@[EMAIL PROTECTED  2008-05-07 19:15:10 
Using a composite SQL type in C
heron@[EMAIL PROTECTED]   2008-05-07 17:29:32 
Re: Custom Base Type in C
odnamr@[EMAIL PROTECTED]   2008-05-07 18:02:29 
Re: Custom Base Type in C
odnamr@[EMAIL PROTECTED]   2008-05-07 18:14:46 
Re: Custom Base Type in C
dim@[EMAIL PROTECTED] (D  2008-05-08 14:03:39 
Re: Using a composite SQL type in C
odnamr@[EMAIL PROTECTED]   2008-05-08 11:11:26 
Re: Using a composite SQL type in C
heron@[EMAIL PROTECTED]   2008-05-08 11:20:07 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 12:46:40 CST 2008.