Re: error messages VERY misleading...!

From: will trillich <will(at)serensoft(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: error messages VERY misleading...!
Date: 2001-03-22 18:42:12
Message-ID: 20010322124212.B10503@mail.serensoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Mar 21, 2001 at 06:46:44AM -0800, Stephan Szabo wrote:
>
> On Wed, 21 Mar 2001, will trillich wrote:
>
> > DECLARE
> > val int4;
> > BEGIN
> > -- minutes
> > val := int( date_part(''epoch'',current_timestamp - $1) / 60 ) ;
> > IF val < 60 THEN
> > val := val / 5; -- round down to 5-minute chunks
> > IF val < 1
> > val := 1;
> > END IF;
> > return (val * 5) || '' min'';
> > END IF;
> > -- other time chunks follow
> > END;
> > ' LANGUAGE 'plpgsql';
> >
> >
> > do you see the problem? i sure didn't, not for SEVEN HOURS
> > (thankyouverymuch). here's why:
> >
> >
> > psql=> SELECT showage( CURRENT_TIMESTAMP );
> > ERROR: parser: parse error at or near "$2"
>
> My guess is that the variables are treated as $ things
> ($1 in this case is your argument, $2 == val)
>
> So it's complaining at the val:=1 line.
>
> Yeah, those messages could use help.

they need an industrial crane, lemme tellya.

even a line number or a snapshot from context would be nice:

ERROR: parser: parse error at or near "$2" in line 9 of 'proc'
ERROR: parser: parse error at or near "$2" in "val := 1;"

ah well.

--
It is always hazardous to ask "Why?" in science, but it is often
interesting to do so just the same.
-- Isaac Asimov, 'The Genetic Code'

will(at)serensoft(dot)com
http://newbieDoc.sourceforge.net/ -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Creager, Robert S 2001-03-22 19:09:13 RE: using NEW in a trigger calling a function in plpgsq l...
Previous Message will trillich 2001-03-22 18:36:29 Re: Hope it is not too offtopic