Why does this not work?

From: "Johann Zuschlag" <zuschlag(at)online(dot)de>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Why does this not work?
Date: 2002-04-11 16:38:55
Message-ID: E16vhbP-0007B0-00@mrvdomng0.kundenserver.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-- Table: test
CREATE TABLE "test" (
"test1" varchar(10)
) WITH OIDS;

-- Function: laenge()
CREATE FUNCTION "laenge"() RETURNS "opaque" AS '
begin
if length(new.test1) > 10 then
new.test1 = substr(new.test1,1,9);
end if;
return new;
end
' LANGUAGE 'plpgsql';

-- Trigger: laenge_trig ON test
CREATE TRIGGER "laenge_trig" BEFORE INSERT OR UPDATE ON "test" FOR EACH ROW EXECUTE PROCEDURE laenge();

insert into test (test1) values ('0123456789012');

value too long for type character varying(10)

regards

Johann Zuschlag
zuschlag(at)online(dot)de

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2002-04-11 16:42:59 Re: "NOT IN" predicate hangs result
Previous Message Neil Conway 2002-04-11 16:26:32 Re: "NOT IN" predicate hangs result