Thread: Another 7.1 EXECUTE Question

Another 7.1 EXECUTE Question

From
Brian Troxell
Date:
I'm getting an error when forming SELECT statements using the new 7.1
EXECUTE command. The error states, simply, that there was an unexpected
SELECT within the EXECUTE command.

Which leads me to ask: can I actually form SELECT statements using
EXECUTE, or is there something else I need to be doing?

Thanks in advance.

-Brian Troxell
trox@mindspring.com


Re: Another 7.1 EXECUTE Question

From
Tom Lane
Date:
Brian Troxell <trox@mindspring.com> writes:
> I'm getting an error when forming SELECT statements using the new 7.1
> EXECUTE command. The error states, simply, that there was an unexpected
> SELECT within the EXECUTE command.

For no good reason that I can see, the original coding for EXECUTE
rejected SELECTs.  While there isn't a provision for doing anything
with the value(s) returned by the SELECT, this is still pretty silly:
for example "SELECT setval('seq', n)" is useful even without looking
at the result value.  So I took out that restriction a day or two ago.
As of the current snapshot, you can execute a SELECT, but the results
will be discarded (unless you do SELECT INTO).

            regards, tom lane

Re: Another 7.1 EXECUTE Question

From
Brian Troxell
Date:
Brian Troxell wrote:

> I'm getting an error when forming SELECT statements using the new 7.1
> EXECUTE command. The error states, simply, that there was an unexpected
> SELECT within the EXECUTE command.
>
> Which leads me to ask: can I actually form SELECT statements using
> EXECUTE, or is there something else I need to be doing?
>
> Thanks in advance.

Cleverly, I left out a lot of details.

I was actually trying to use EXECUTE to call another defined function,
creating that function name on the fly. Is this possible at all?

I've even gone so far as to hard-code the execute statement with the
desired function (execute ''select function_name(2)'';) and that also gave
the same error.

Thanks again! (in advance)

-Brian Troxell
trox@mindspring.com