Re: PSQL - Mailing list pgsql-novice

From Tom Lane
Subject Re: PSQL
Date
Msg-id 27170.1278425798@sss.pgh.pa.us
Whole thread Raw
In response to PSQL  (Atif Jung <atifjung@gmail.com>)
List pgsql-novice
Atif Jung <atifjung@gmail.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

pgsql-novice by date:

Previous
From: Atif Jung
Date:
Subject: PSQL
Next
From: Greg
Date:
Subject: Data type OIDs