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

(plpgsql) DECLARE foo NUMERIC(5,2): syntax error at "("

From: Angus Lees <gus(at)switchonline(dot)com(dot)au>
To: pgsql-bugs(at)postgresql(dot)org
Subject: (plpgsql) DECLARE foo NUMERIC(5,2): syntax error at "("
Date: 2002-02-21 03:34:41
Message-ID: 20020221033441.GA1092@roach.switchonline.com.au (view raw or flat)
Thread:
Lists: pgsql-bugs
PL/pgSQL docs say "PL/pgSQL variables can have any SQL datatype".

but when i try:

CREATE FUNCTION foo() RETURNS NUMERIC(5,2) AS '
DECLARE
	bar NUMERIC(5,2);
BEGIN
	bar := 123.45;
	return bar;
END;
' LANGUAGE 'plpgsql';


then "select foo()" gives:
NOTICE:  plpgsql: ERROR during compile of foo near line 2
ERROR:  parse error at or near "("


declaring bar as "FLOAT8" (for example) works as expected.


from a quick look at plpgsql/src/gram.y, the decl_dtypename rule
only allows type modifiers (decl_attypmod) on CHAR, VARCHAR or BPCHAR.

scan.l doesn't even recognise NUMERIC or DECIMAL as keywords.


(debian postgresql 7.1.3-6 package on Linux/Intel)

-- 
 - Gus

Responses

pgsql-bugs by date

Next:From: Andy MardenDate: 2002-02-21 07:59:38
Subject: Re: Dates and year 2000
Previous:From: Tom LaneDate: 2002-02-21 03:23:58
Subject: Re: Trying Cygwin version of PostgreSQL

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