Hello all,
I am using PostgreSQL 8.0.1 on a Windows 2003 platform.
I am (trying to) set up a function and a related insert trigger via pgAdmin3 / psql, but I am not
succeeding.
I have set up a bare bones function named update_rpt_history (stripped down because of trying
to eliminate any errors).
CREATE OR REPLACE FUNCTION update_rpt_history(char) RETURNS INTEGER AS $$
BEGIN
RETURN 0;
END
$$ LANGUAGE plpgsql;
The only message I get back from pgAdmin3 is:
Query returned successfully with no result in 47 ms.
I don't know whether 'no result' means success or not, as it does not appear in pgAdmin's list of
functions after executing. So I went into psql, and found that the function does appear to exist:
adns-# \df update_rpt_history;
List of functions
Schema | Name | Result data type | Argument data types
--------+--------------------+------------------+---------------------
public | update_rpt_history | integer | character
(1 row)
So, I proceeded to try to set up a trigger against it in pgAdmin3 like so:
create trigger tg_crchist_aft_ins after insert on adns_crc_history
for each row execute procedure update_rpt_history(crc)
and got back this response from pgAdmin3:
ERROR: function update_rpt_history() does not exist
Tried the command again qualified by schema name (public.) but got same response.
Tried the create trigger command in psql, but same result.
adns=# create trigger tg_crchist_aft_ins after insert on adns_crc_history
adns> for each row execute procedure update_rpt_history(crc);
ERROR: function update_rpt_history() does not exist
Questions:
(1) Can anyone tell what I am doing wrong?
(2) Why the inconsistent reporting on the presence of a function between pgAdmin3 and psql?
(3) If I am doing something wrong, does PostgreSQL make any attempt to tell you what is
wrong? So far, the messages have been cryptic and non-specific.