From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Michael Moore <michaeljmoore(at)gmail(dot)com> |
Cc: | postgres list <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: INOUT text[],OUT text parameter handling problem |
Date: | 2016-05-24 23:43:04 |
Message-ID: | CAKFQuwb6eismXy74OXa4uE7MqZxXwcOgmDM627i49p95uOLfFA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Tue, May 24, 2016 at 7:19 PM, Michael Moore <michaeljmoore(at)gmail(dot)com>
wrote:
> So, why would anybody ever want an INOUT parameter? Rhetorical question,
> not expecting an answer. So, since I am going to have to get a copy back
> from the CALLED function, then I will need to replace the original text[]
> with the one I got back. It would probably be more efficient to just do the
> array_append function in the caller and pass the array length to fbind.
>
FWIW the line immediately preceding the one quoted previously was a good
opportunity to "call by reference" if it was allowed:
> using_values := array_append(using_values, 'the first entry'::text);
array_append is a "pure function"[1] though for non-trivial arrays having
mutable properties would be much more efficient.
By the way, not that you should care, but Oracle has an INOUT parameter
> that does a COPY or you can specify "INOUT NOCOPY" which is of course your
> call by reference.
>
It helps explain where all these heretical thoughts come from ;)
David J.
1. https://en.wikipedia.org/wiki/Functional_programming#Pure_functions
From | Date | Subject | |
---|---|---|---|
Next Message | Achilleas Mantzios | 2016-05-25 06:42:31 | Array casting in where : unexpected behavior |
Previous Message | Michael Moore | 2016-05-24 23:19:27 | Re: INOUT text[],OUT text parameter handling problem |