X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 033E6D1B211 for ; Thu, 10 Jun 2004 12:01:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70129-02 for ; Thu, 10 Jun 2004 15:01:34 +0000 (GMT) Received: from server18.pronicsolutions.com (server18.pronicsolutions.com [64.94.233.81]) by svr1.postgresql.org (Postfix) with ESMTP id 26288D1B1D9 for ; Thu, 10 Jun 2004 12:01:33 -0300 (ADT) Received: from datalong by server18.pronicsolutions.com with local (Exim 4.34) id 1BYR3Z-00024q-OR for pgsql-sql@postgresql.org; Thu, 10 Jun 2004 11:01:29 -0400 Received: from 161.88.255.139 ([161.88.255.139]) (SquirrelMail authenticated user mlong@datalong.com) by datalong.com with HTTP; Thu, 10 Jun 2004 11:01:29 -0400 (EDT) Message-ID: <49717.161.88.255.139.1086879689.squirrel@datalong.com> In-Reply-To: <20040610160627.B1308@hermes.hilbert.loc> References: <37936EEC582B394A9E1AA951991A551604C3C0@dev001_pdc.Dev.cadcorp.net> <20040610160627.B1308@hermes.hilbert.loc> Date: Thu, 10 Jun 2004 11:01:29 -0400 (EDT) Subject: Function returns error From: "Michael Long" To: pgsql-sql@postgresql.org Reply-To: mlong@datalong.com User-Agent: SquirrelMail/1.4.0 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 X-Priority: 3 Importance: Normal X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server18.pronicsolutions.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [32026 527] / [47 12] X-AntiAbuse: Sender Address Domain - server18.pronicsolutions.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.8 tagged_above=0.0 required=5.0 tests=PRIORITY_NO_NAME X-Spam-Level: X-Archive-Number: 200406/87 X-Sequence-Number: 18032 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