Re: PSQL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Atif Jung <atifjung(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: PSQL
Date: 2010-07-06 14:16:38
Message-ID: 27170.1278425798@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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

In response to

  • PSQL at 2010-07-06 09:24:49 from Atif Jung

Browse pgsql-novice by date

  From Date Subject
Next Message Greg 2010-07-06 22:12:27 Data type OIDs
Previous Message Atif Jung 2010-07-06 09:24:49 PSQL