Re: what are the ways to avoid --- "ERROR: EXECUTE of SELECT ... INTO is not implemented yet"

From: tomas(at)tuxteam(dot)de
To: Shantanu <shantanu(dot)gg(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: what are the ways to avoid --- "ERROR: EXECUTE of SELECT ... INTO is not implemented yet"
Date: 2008-05-31 03:08:20
Message-ID: 20080531030820.GA18863@tomas
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, May 30, 2008 at 09:57:49PM +0530, Shantanu wrote:
> Hello experts,
>
>
> I am facing this error.
>
> mydb=> select version();
> version
>
> --------------------------------------------------------------------------------
>
> PostgreSQL 8.1.9
>
> (1 row)
>
> mydb=> \i /tmp/test.sql
> CREATE FUNCTION
> mydb=> select sp_test();
> ERROR: EXECUTE of SELECT ... INTO is not implemented yet
> CONTEXT: PL/pgSQL function "sp_test" line 4 at execute statement
>
>
> mydb=>
> [1]+ Stopped su - dbu
> mymachine<root># cat /tmp/test.sql
> create or replace function sp_test() RETURNS void as $$
> declare
> l_var timestamp;
> begin
> execute 'SELECT NOW() INTO l_var';
^^^^^^^^^^^^^^^^^^

Why do you need execute '...' at all? Why not directly do instead

SELECT NOW() into l_var;

What is your "real" use case?

Note that if you really need the dynamic command, you might put its
result int a variable, like so:

EXECUTE 'SELECT NOW()' INTO l_var;

...but if we don't know what you are trying to achieve, it's difficult
to provide meaningful recommendations.

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIQMEjBcgs9XrR2kYRAnaWAJ9Mpu/qvqzi911yiftbe3lLYZiyLgCfcWIl
TKs78mgZiKFRZcHnmHMQnOw=
=I2iD
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Craig Ringer 2008-05-31 04:43:34 Re: what are the ways to avoid --- "ERROR: EXECUTE of SELECT ... INTO is not implemented yet"
Previous Message Gerardo Antonio 2008-05-30 16:42:18 problems compiling in 64 bits