Thrasher,

> I think I'll follow your advice, as this is the method that I had in my 
> pocket to use if I had no response. I tried with TRIM and other 
> functions in the CHECK constraint, but I guess that I cannot use 
> functions over a check field.
> 
> It surprised me, but anyway, I'll do that.
> 
> Thanks a lot for your prompt reply

No problem.  You should also add a second constraint: 
CHECK ((type = 'x' AND data2 <> 'blank value') OR (type = 'y' AND data2 = 
'blank value'))

To enforce your other criterion.  

Keeop in mind that depending on the rest of your data structure, there are 
probably 8 different ways to approach this problem.  I'd reccomend, in fact, 
a quick reading of Pascal's "Practical Issues in Database Management" on 
normalization to see the different table structures that might work for you.

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to