From: Michael Long <mlong@datalong.com>
To: pgsql-sql@postgresql.org
Subject: Function returns error
Date: Thu, 10 Jun 2004 11:01:29 -0400 (EDT)
Message-ID: <49717.161.88.255.139.1086879689.squirrel@datalong.com> (raw)
In-Reply-To: <20040610160627.B1308@hermes.hilbert.loc>
References: <37936EEC582B394A9E1AA951991A551604C3C0@dev001_pdc.Dev.cadcorp.net>
<20040610160627.B1308@hermes.hilbert.loc>
Hi All,
I am a relatively new user to postgres. I have created a function that compiles but
generates an error when executed. I know I am overlooking something simple. The
function and error are below.
CREATE OR REPLACE FUNCTION building_insert(varchar, int4, varchar)
RETURNS int4 AS
'
/* Return code dictionary:
0 - Success
1 - Valid User, Insert Failed
2 - Invalid User, Abort
*/
DECLARE
p_user ALIAS FOR $1;
p_parcel_id ALIAS FOR $2;
p_name ALIAS FOR $3;
BEGIN
IF p_user == \'mlong\' THEN
RETURN 2;
END IF;
INSERT INTO
building(
parcel_id,
name,
createdate
)
VALUES(
p_parcel_id,
p_name,
now()
);
RETURN 0;
END;
' LANGUAGE 'plpgsql' VOLATILE;
/* Query that generates error */
select building_insert('mlong', 20,'building 1');
ERROR: operator does not exist: character varying == "unknown"
HINT: No operator matches the given name and argument type(s). You may need to add
explicit type casts.
CONTEXT: PL/pgSQL function "building_insert" line 14 at if
Thanks,
Mike
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mlong@datalong.com
Subject: Re: Function returns error
In-Reply-To: <49717.161.88.255.139.1086879689.squirrel@datalong.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox