Re: Functions returning more than one value

From: "Chris Ruprecht" <chrup999(at)yahoo(dot)com>
To: "pgsql" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Functions returning more than one value
Date: 2001-08-08 15:20:23
Message-ID: 006601c1201d$a56848e0$5dd26383@corp.compucom.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Josh,

the two functions are just a tiny example of what I want to do which is:
call a function with 2 or more arguments (v_val1 and v_val2).

The called function (test2() in the example) will MODIFY the two arguments
and then return a true value. After test2() has run, the value of the two
arguments 'has changed' to what test2() has assigned to them.

I know that this might not be good programming practice since many
applications rely on functions NOT changing the variables which get passed
to them as arguments. maybe if we could specially declare them as
'changeable' parameters ...

The functionality of 'returns record' is nice to have but it would not help
me in this case. I would have to create a record each time I want to pass
more than one value back to the calling procedure. This means 'disk access'
which is another word for 'this is going to slow down my program'. But this
reminds me: where are temp tables kept? On disk or in memory? - that might
be a way out of the dilemma.

Best regards,
Chris

----- Original Message -----
From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: "Chris Ruprecht" <chrup999(at)yahoo(dot)com>
Sent: Wednesday, August 08, 2001 10:06 AM
Subject: Re: [SQL] Functions returning more than one value

> Chris,
>
> > How can I get more than one value back from a function?
>
> I assume that you're looking for a workaround here. You've been on the
> list long enough to know that we're all waiting for record-returning
> ability in 7.2, 7.3 or more likely 8.0.
>
> > The most elegant would be something like the 2 functions listed
> > below. They
> > don't work, since v_val3 and v_val4 are treated as constants in
> > test2() and
> > can not be changed. Is there a way this can make it into a future
> > release?
>
> I'm *really* confused. These functions seem to have nothing to do with
> your first question. Mind documenting, line-by-line, what you're trying
> to do with the two functions you provided? I can't puzzle it out from
> your code.
>
> -Josh
>
> ______AGLIO DATABASE SOLUTIONS___________________________
> Josh Berkus
> Complete information technology josh(at)agliodbs(dot)com
> and data management solutions (415) 565-7293
> for law firms, small businesses fax 621-2533
> and non-profit organizations. San Francisco
>

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Cedar Cox 2001-08-08 16:02:01 REFERENCES constraint
Previous Message Andreas Joseph Krogh 2001-08-08 14:41:06 Re: RE: Referencing named attribute in where clause doesn't work with7.1.2?