postgresql - Insert into PERSOANE table return violates check constraint but shouldn't -
this creation script:
create table persoane ( idpers numeric (5) constraint pk_persoane primary key, numepren varchar (30) constraint ck_nume check (numepren=ltrim(initcap(numepren))), loc varchar (30) constraint nn_loc not null constraint ck_loc check (loc=ltrim(initcap(loc))), jud varchar (25) constraint nn_jud not null constraint ck_jud check (jud=ltrim(initcap(jud))), tel numeric (10) constraint nn_tel not null, e_mail varchar(254) constraint nn_e_mail not null constraint ck_e_mail check (e_mail = ltrim(e_mail)) );
when try insert values in table got error: new row relation "persoane" violates check constraint "ck_jud" here insert script:
insert persoane values (11111, 'slimi marius', 'oras', 'judet', 0752361507, 'simic@yahoo.com');
anyone has suggestion how fix problem?
initcap()
change first character uppercase. check constraints on columns numepren
, loc
, jud
require enter values first character of every word in uppercase. in value 'jude'
first character lowercase, check constraint violated. need use 'jude'
instead. true other columns have defined:
insert persoane (idpers, numepren, loc, jud, tel, e_mail) values (11111, 'slimi marius', 'oras', 'judet', 0752361507, 'simic@yahoo.com');
Comments
Post a Comment