Skip site navigation (1) Skip section navigation (2)

Weird misinterpretation of EXECUTE in PL/pgSQL

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Weird misinterpretation of EXECUTE in PL/pgSQL
Date: 2007-02-09 18:00:09
Message-ID: 200702091900.10259.peter_e@gmx.net (view raw or flat)
Thread:
Lists: pgsql-bugs
PostgreSQL 8.2.1

This is OK:

test=# create function test1() returns int language plpgsql as $$begin execute 'select a, b'; end$$;
CREATE FUNCTION
test=# select test1();
ERROR:  column "a" does not exist
LINE 1: select a, b
               ^
QUERY:  select a, b
CONTEXT:  PL/pgSQL function "test1" line 1 at execute statement

This is weird:

test=# create function test2() returns int language plpgsql as $$begin execute 'select a', 'b'; end$$;
/* Several arguments separated by comma -- doesn't make sense */
CREATE FUNCTION
test=# select test2();
ERROR:  query "SELECT  'select a', 'b'" returned 2 columns
CONTEXT:  PL/pgSQL function "test2" line 1 at execute statement

In the presence of a comma-separated list of arguments it seems to
intepret the EXECUTE command wildly differently.  What is going on here?

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2007-02-09 18:54:24
Subject: Re: Weird misinterpretation of EXECUTE in PL/pgSQL
Previous:From: Gabriel BravoDate: 2007-02-09 17:27:45
Subject: BUG #2984: Bug Creating or Updating a View

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group