Matthias,
the easiest way is to use CHECK constraints. see example below.
Servus,
Peter
Matthias Teege wrote:
is there any way to limit values to upper case strings?
Somthing like:
name char(15) DEFAULT (upper(name))
or must I use triggers?
test=# create table bla(bb char(10) CHECK
Title: RE: [GENERAL] Convert to upper
It may be better using a trigger. You don't then get the error message (from the constraint) the record is just updated with the uppercase version of what was inserted.
Regards
Ben
-Original Message-
From: Peter Schindler [mailto:[EMAIL
Title: RE: [GENERAL] Convert to upper
Why not just do:
INSERT INTO TABLE (uppercase_value) VALUES
(upper('value'));
Leave in the check, and all problems are solved
without overhead of a trigger. Simple checks like the one shown don't have
any noticeable speed loss. Trigger overhead does