Re: [SQL] PL/PGSQL function with parameters - Mailing list pgsql-hackers

From Florent Guillaume
Subject Re: [SQL] PL/PGSQL function with parameters
Date
Msg-id 20010206221522.A21727@twin.efge.org
Whole thread Raw
In response to Re: [SQL] PL/PGSQL function with parameters  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Re: [SQL] PL/PGSQL function with parameters  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> >     SQL = ''SELECT * INTO temp1 FROM '' || $1;
> 
> I tried this, and it seems that "SELECT ... INTO foo" is not executed
> correctly by EXECUTE --- the INTO is handled as an ordinary select-into-
> table construct rather than plpgsql's select-into-variable.
> 
> While I have not looked closely, I seem to recall that plpgsql handles
> INTO by stripping that clause out of the statement before it's passed to
> the SQL engine.  Evidently that's not happening in the EXECUTE case.

From gram.y, yes it tries to strip the INTO by skipping over some stuff,
maybe the "*" trips it ?

Anyway the syntax SELECT INTO temp1 * FROM .... should work.


On this same subject, the plpgsql doc says to useSELECT expression INTO var FROM ...
but Bruce's book, in several examples ("PL/PGSQL Functions" for instance,
node203.html) usesSELECT INTO var expression FROM ...

Both should work, but there may be there's something to straighten up here.


Cheers,

Florent


-- 
florent.guillaume@mail.com


pgsql-hackers by date:

Previous
From: Florent Guillaume
Date:
Subject: Re: [PATCHES] A Sparc/Linux patch (for 7.1), and a Linux rc.d/init.d script....
Next
From: Bruce Momjian
Date:
Subject: Re: Re: [PATCHES] A Sparc/Linux patch (for 7.1), and a Linux rc.d/init.d script....