plpgsql Cursor Mismatched Parentheses
plpgsql Cursor Mismatched Parentheses
От:
<cnliou@eurosport.com>
Дата:
Hi! I have never successfully used bounded parameterized cursors. Error occurs when opening cursor. Please see below and help! Regards, CN =========================== CREATE FUNCTION test(SMALLINT,SMALLINT) RETURNS BOOLEAN AS ' DECLARE y1 ALIAS FOR $1; m1 ALIAS FOR $2; o TEXT; y2 SMALLINT; m2 SMALLINT; c CURSOR (o TEXT,y1 SMALLINT,m1 SMALLINT,y2 SMALLINT,m2 SMALLINT) IS SELECT column1,column2 FROM table1 WHERE column9=o AND column3 BETWEEN (SELECT column3 FROM table1 WHERE column9=o AND column1=y1 AND column2=m1) AND (SELECT column3 FROM table1 WHERE column9=o AND column1=y2 AND column2=m2) ORDER BY 1,2; BEGIN o:=''xxx''; y2:=2002; m2=7; OPEN c(o,y1,m1,y2,m2); CLOSE c; RETURN TRUE; END;' LANGUAGE 'plpgsql'; ====================== database=# select test(2002,5); NOTICE: plpgsql: ERROR during compile of test near line 17 ERROR: mismatched parentheses -------------------------------------------------------- You too can have your own email address from Eurosport. http://www.eurosport.com
Re: plpgsql Cursor Mismatched Parentheses
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
writes: > OPEN c(o,y1,m1,y2,m2); > database=# select test(2002,5); > NOTICE: plpgsql: ERROR during compile of test near > line 17 > ERROR: mismatched parentheses I broke this case shortly before 7.2 release, and it didn't get detected till after :-(. If you want to recompile, you can replace src/pl/plpgsql/src/gram.y with version 1.29.2.1, see http://developer.postgresql.org/cvsweb.cgi/pgsql/src/pl/plpgsql/src/gram.y regards, tom lane