pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chairudin Sentosa Harjo <chai@prima.net.id>
To: pgsql-sql@postgresql.org
Subject: Constraint Problem
Date: Thu, 30 Sep 1999 15:05:26 +0700
Message-ID: <37F319C6.FA5B5536@prima.net.id> (raw)

Dear Friends,

I have a very wierd problem. It should be obvious, but I can't
understand why.

I am using Postgresql 6.5.2, SuSe 6.2, Pentium III, Kernel Linux 2.2.10.

Please notice the error, it keeps saying ck_ngetest_disc_pin,
ck_ngetest_disc_country
is the cause of the problem.
I have inserted the correct value, but why keep giving error???

The wierdest part is, when I insert a value to field "disc_all", the
error mentioned
"ck_ngetest_disc_pin" !!!.... If the constraint was violated, the error
message
should be "ck_ngetest_disc_all".


create table ngetest
  (
   custnum              int8 NOT NULL,
   first_name           varchar(15) NOT NULL,
   service_type         char NOT NULL,
   sex                  char NOT NULL,
   detailed_bill        char NOT NULL,
   ngetest_status       char NOT NULL,
   disc_all             char,
   disc_country         char,
   disc_pin             char,

   constraint pk_ngetest PRIMARY KEY (custnum),

   constraint ck_ngetest_service_type check
     (service_type = 'Y' or
      service_type = 'N' or
      service_type = 'G' or
      service_type = 'M' or
      service_type = 'O' or
      service_type = 'D'),

   constraint ck_ngetest_status check
     (ngetest_status = 'A' or
      ngetest_status = 'I' or
      ngetest_status = 'S' or
      ngetest_status = 'T'),

   constraint ck_ngetest_disc_all check
     (disc_all = 'Y' or
      disc_all = 'N'),
   constraint ck_ngetest_disc_country check
     (disc_country = 'Y' or
      disc_country = 'N'),
   constraint ck_ngetest_disc_pin check
     (disc_pin = 'Y' or
      disc_pin = 'N')
  );

insert into ngetest
(custnum, first_name, service_type, sex, detailed_bill, ngetest_status,
disc_all)
values
(1,'Bob','Y','M','Y','A','Y');
ERROR:  ExecAppend: rejected due to CHECK constraint ck_ngetest_disc_pin

insert into ngetest
(custnum, first_name, service_type, sex, detailed_bill, ngetest_status,
disc_country)
values
(2,'Mike','Y','M','Y','A','Y');
ERROR:  ExecAppend: rejected due to CHECK constraint ck_ngetest_disc_pin

insert into ngetest
(custnum, first_name, service_type, sex, detailed_bill, ngetest_status,
disc_pin)
values
(3,'John','Y','M','Y','A','Y');
ERROR:  ExecAppend: rejected due to CHECK constraint
ck_ngetest_disc_country


Regards,
Chairudin Sentosa

************



view thread (13+ messages)  latest in thread

Message-ID: <37F319C6.FA5B5536@prima.net.id>
Permalink:  ../37F319C6.FA5B5536@prima.net.id/
Also on:    postgresql.org/message-id/37F319C6.FA5B5536@prima.net.id

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: chai@prima.net.id
  Subject: Re: Constraint Problem
  In-Reply-To: <37F319C6.FA5B5536@prima.net.id>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox