question on function definitions/casts

From: Cindy <ctmoore(at)uci(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: question on function definitions/casts
Date: 2002-02-20 21:15:42
Message-ID: 17659.1014239742@stephanus.tlg.uci.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


ANyway, I have another question for you guys.

create function get_citation (int2, int2, int4)
returns SETOF varchar AS
'select citation from citations where aid=$1 and wid=$2 and byteloc=$3'
LANGUAGE 'SQL'

At one point I retrieved this function from my psql db (I've taken over
from someone else) and I'm now in a position where I need to enter it again.
I got it using pg_dump -s (on the kind suggestion of Tom when I asked back
then).

However, when I enter it now, it just doesn't seem to like it.

I get:

Text=# create function get_citation (int2, int2, int4)
Text-# returns SETOF varchar AS
Text-# 'select citation from citations where aid=$1 and wid=$2 and byteloc=$3'
Text-# LANGUAGE 'SQL';
ERROR: Unable to identify an operator '=$' for types 'int2' and 'int4'
You will have to retype this query using an explicit cast
Text=#

I'm guessing this is a difference from an upgrade to psql?

I'm using:
[1:08pm] stephanus ~> psql -V
psql (PostgreSQL) 7.1.3

would this be something like:

cast(aid as int2)=$1
or
(int2 aid)=$1

I've read through the stuff in
http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/typeconv-oper.html
but I'm still confused.

Thanks,
--Cindy

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dean Hill 2002-02-20 21:22:40 Re: documention on psql?
Previous Message Herbert Liechti 2002-02-20 21:07:41 Re: Ordering 'A', 'B', ..., 'Z', 'AA', 'AB', ...