pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave A. <pgadmin@pod13.com>
To: pgsql-sql@postgresql.org
Subject: function does not exist
Date: Fri, 10 Jan 2003 17:22:47 -0500
Message-ID: <001c01c2b8f6$ce15dc80$fd00000a@pod13.com> (raw)

I am using postgresql version 7.2.3, and have the following situation.

When I attempt to add a function, I get the error CreateTrigger: function
mem_leveled() does not exist.  Using the function in psql (i.e. SELECT
mem_leveled('fubar', 4, '2002/12/30 10:09:00 GMT'); ) works fine, I just
can't create a trigger for it.

I know its something stupid I'm doing (or not doing).

CREATE TABLE members (
    name CHARACTER VARYING(256),
    level smallint,
    date_updated timestamptz,
    ... other stuff ...
)

CREATE TABLE mem_history (
    name CHARACTER VARYING(256),
    level smallint,
    date_achieved timestamptz
)

CREATE FUNCTION mem_leveled (varchar, smallint, timestamptz) RETURN BOOLEAN
AS
'DELCARE
    mem_lvl RECORD;
BEGIN
    SELECT INTO mem_lvl * FROM mem_history WHERE name = $1 AND level = $2;
    IF NOT FOUND THEN
        INSERT INTO mem_history VALUES ($1, $2, $3);
    END IF;
  RETURN TRUE;
END;
' LANGUAGE 'plpgsql';

CREATE TRIGGER update_mem_level AFTER INSERT OR UPDATE
ON members FOR EACH ROW
EXECUTE PROCEDURE mem_leveled('name', 'level', 'date_updated');

------
Dave A.




view thread (3+ messages)  latest in thread

Message-ID: <001c01c2b8f6$ce15dc80$fd00000a@pod13.com>
Permalink:  ../001c01c2b8f6$ce15dc80$fd00000a@pod13.com/
Also on:    postgresql.org/message-id/001c01c2b8f6$ce15dc80$fd00000a@pod13.com

 · 

reply

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: pgadmin@pod13.com
  Subject: Re: function does not exist
  In-Reply-To: <001c01c2b8f6$ce15dc80$fd00000a@pod13.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