============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================
Your name : Thomas Erskine Your email address : [EMAIL PROTECTED]
System Configuration --------------------- Architecture (example: Intel Pentium) :Intel Pentium III
Operating System (example: Linux 2.0.26 ELF) :Linux 2.4.20 ELF
PostgreSQL version (example: PostgreSQL-7.2.3):PostgreSQL-7.3.4-1PGDG
Compiler used (example: gcc 2.95.2) : the RPM did it :-)
Please enter a FULL description of your problem: ------------------------------------------------ A before trigger doesn't always fire. If a column being inserted into is too small for the incoming data, psql complains: ERROR: value too long for type ... without giving the trigger procedure a chance to deal with it.
Please describe a way to repeat the problem. Please try to provide a concise reproducible example, if at all possible: ---------------------------------------------------------------------- ------ cut here ------ CREATE TABLE test( id INTEGER, code CHARACTER(4) );
CREATE FUNCTION test_func()
RETURNS TRIGGER
AS 'BEGIN
IF LENGTH(new.code) > 4
THEN new.code = ''xxxx'';
END IF;
new.code = upper(new.code);
RETURN new;
END;'
LANGUAGE 'plpgsql';CREATE TRIGGER test_trig BEFORE INSERT ON test FOR EACH ROW EXECUTE PROCEDURE test_func();
INSERT INTO test VALUES( 1, 'aaaa');
INSERT INTO test VALUES( 2, 'bbbbb'); ------ cut here ------ The first INSERT works fine and the function is triggered. The second INSERT never triggers the function; it just complains.
If you know how this problem might be fixed, list the solution below: ---------------------------------------------------------------------
Thomas Erskine <[EMAIL PROTECTED]> +1.613.591.8490
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly
