On 2009-04-25, Leif B. Kristensen <l...@solumslekt.org> wrote: > I've got a function that returns both an integer and a string as a > user-defined composite type int_text: > > -- CREATE TYPE int_text AS (number INTEGER, string TEXT); > > Basically, the function does some heuristics to extract a sort order > number from a text, and conditionally modify the text: > > CREATE OR REPLACE FUNCTION get_sort(INTEGER, INTEGER, TEXT) > RETURNS int_text AS $$ ...
> To use the two values in an other function where I've declared a > variable sort_text of type int_text, I do like this: > > SELECT number, string FROM get_sort(par_id, srt, txt) INTO sort_text; the above is equivalent to sort_text = get_sort(par_id, srt, txt); > srt := sort_text.number; > txt := sort_text.string; > But I feel it's a little awkward. Is there a more elegant way to do it? SELECT * FROM get_sort(par_id, srt, txt) INTO srt,txt; -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql