pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedparse error when calling function in plpgsql
2+ messages / 2 participants
[nested] [flat]
* parse error when calling function in plpgsql
@ 2003-03-14 09:18 David Witham <davidw@unidial.com.au>
2003-03-17 19:48 ` Re: parse error when calling function in plpgsql Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: David Witham @ 2003-03-14 09:18 UTC (permalink / raw)
To: pgsql-sql
I have a function that returns a record that works fine when I call it from psql:
mydb=# select * from myfunc(...params...) as (col1 real,col2 integer);
col1 | col2
---------+----------
0.806667 | 17000104
(1 row)
I have tried to call it from within another function like this:
...
declare
myrec record;
...
select * into myrec from myfunc(...params...) as (col1 real,col2 integer);
...
but I keep getting a parse error:
WARNING: Error occurred while executing PL/pgSQL function myparentfunc
WARNING: line 27 at select into variables
ERROR: parser: parse error at or near "$1" at character 72
How do I get the record returned from myfunc to be assigned to myrec?
Thanks,
David Witham
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: parse error when calling function in plpgsql
2003-03-14 09:18 parse error when calling function in plpgsql David Witham <davidw@unidial.com.au>
@ 2003-03-17 19:48 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2003-03-17 19:48 UTC (permalink / raw)
To: David Witham <davidw@unidial.com.au>; +Cc: pgsql-sql
"David Witham" <davidw@unidial.com.au> writes:
> myrec record;
> ...
> select * into myrec from myfunc(...params...) as (col1 real,col2 integer);
> but I keep getting a parse error:
> WARNING: Error occurred while executing PL/pgSQL function myparentfunc
> WARNING: line 27 at select into variables
> ERROR: parser: parse error at or near "$1" at character 72
I doubt this has anything to do with the function per se. I'd check for
a conflict between the names you are using as plpgsql variables and the
names mentioned in this SELECT.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2003-03-17 19:48 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-03-14 09:18 parse error when calling function in plpgsql David Witham <davidw@unidial.com.au>
2003-03-17 19:48 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox