public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nikolaos Ikonomopoulos <[email protected]>
To: [email protected]
Subject: CONSTRAINT on ARRAY ELEMENTS
Date: Sat, 3 Nov 2012 09:43:06 +0000
Message-ID: <[email protected]> (raw)



CREATE TABLE employ_presence
(
  p_id character(6) not null,
  p_month character(3) NOT NULL,
  statuscode integer array[7],
  CONSTRAINT unq_employ_presence UNIQUE (p_id, p_month),
  CONSTRAINT chk_employ_month CHECK (p_month = ANY (ARRAY['Jan'::bpchar, 'Feb'::bpchar, 'Mar'::bpchar, 'Apr'::bpchar, 'May'::bpchar, 'Jun'::bpchar, 'Jul'::bpchar, 'Aug'::bpchar, 'Sep'::bpchar, 'Oct'::bpchar, 'Nov'::bpchar, 'Dec'::bpchar]))
);



How can add a CONSTRAINT on statuscode array elements to accept values between 0 to 5

0 = Employ present
1 = Employ  Patient
2 = day off 
3 = Regular vacation
4 = external job assignment 
5 = external job assignment abroad
6 to 9  for future use

Thanks.
 		 	   		  

view thread (4+ messages)  latest in thread

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: [email protected]
  Cc: [email protected]
  Subject: Re: CONSTRAINT on ARRAY ELEMENTS
  In-Reply-To: <[email protected]>

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

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