Atif Jung <atifjung(at)gmail(dot)com> writes:
> I'm having problems with the following stored procedure. The problematic
> line is the one in red. Any help greatly appreciated.
> CREATE or replace FUNCTION converttojulian(datex DATE) RETURNS CHAR(5) AS $$
> ...
> m1 := EXTRACT (MONTH FROM DATE datex);
Drop the word DATE here. datex is already a date, so you don't need to
cast it, and if you did need to cast it this would be the wrong syntax
anyway. DATE 'foo' is only appropriate syntax for a simple literal
constant 'foo'.
regards, tom lane