Re: My error or parser bug? re stored function [SEC=UNCLASSIFIED]

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Pilling, Michael" <Michael(dot)Pilling(at)dsto(dot)defence(dot)gov(dot)au>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: My error or parser bug? re stored function [SEC=UNCLASSIFIED]
Date: 2011-02-11 16:03:02
Message-ID: 29057.1297440182@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

"Pilling, Michael" <Michael(dot)Pilling(at)dsto(dot)defence(dot)gov(dot)au> writes:
> Hi, I'm new to postgres but not to SQL, and have not been able to this stored function to compile:

FWIW, I get completely different errors than you do when I paste these
examples into psql:

ERROR: syntax error at or near "voice_spelling"
LINE 5: IF EXISTS( voice_spelling( $1, $2, $3, $4 ) ) THEN
^

ERROR: syntax error at or near "voice_spelling"
LINE 5: IF EXISTS( voice_spelling( abbreviation, context, tts_engin...
^

These errors make sense to me because the argument of EXISTS() has to
be a sub-SELECT. I'm not sure what you're expecting EXISTS to do with a
function call.

As far as the errors you actually got, it's difficult to say for sure
without any context like what PG version this is or what client-side
software you were using. The formatting you show for the errors sure
doesn't look like psql, though. First guess is that you were passing
the SQL code through something that thinks it knows SQL syntax but
doesn't cope well with dollar-quoted strings, or something like that.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message matty jones 2011-02-11 16:18:25 Re: table design
Previous Message Maximilian Tyrtania 2011-02-11 14:47:43 Re: Make pgAdmin default "Not NULL" checkbox to ON