Hello try to SELECT INTO ARRAY(SELECT user_t FROM users LIMIT 10) _page.users; Regards Pavel Stehule 2011/1/13 Jon Smark <jon.smark@xxxxxxxxx>: > Hi, > > I am trying to create a PL/pgSQL function whose return type is a tuple > consisting of an integer and a list of table rows. ÂI emulate the tuple > by defining a record 'page_t' with the two fields; however, the naÃve > approach of doing a SELECT INTO one the record's fields does not work > (see function 'get_page') below. ÂAm I missing something obvious here? > > Thanks in advance! > Jon > > > create table users >    Â( >    Âuid   int4 not null, >    Âname  Âtext not null, >    Âage   int4 not null, >    Âprimary key (uid) >    Â); > > create type user_t AS >    Â( >    Âuid   int4, >    Âname  Âtext, >    Âage   int4 >    Â); > > create type page_t AS >    Â( >    Âtotal  int4, >    Âusers  user_t[] >    Â); > > create function get_page () > returns page_t > language plpgsql as > $$ > declare >    Â_page  page_t; > begin >    Â_page.total := select count (*) from users; >    Âselect * into _page.users from users limit 10; >    Âreturn _page; > end > $$; > > > > > > -- > Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general > -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general