> > Also, this is a rework of an existing system and dates are stored as > > strings. I don't like it but I'm stuck with it for now. I was hoping to be > > able to provide some DB level validation of the dates as 'YYYY-MM-DD' but I > > havn't come across a neat way to do it yet. I also hope that domains might > > facilitate a smooth change to date type dates someday in the future (in my > > dreams, i guess). In the mean time, if anyone knows a 'neat' way to validate > > the date strings I'd be happy to hear about it. I got bogged down in very > > much over involved (an probably slow) code that couldn't guarantee a valid > > date anyway. The date conversion function to_date is far too forgiving to > > fulfill this purpose, it seems. > > You can use a check constraint with a regular expression. It would look > something like like: > check (datecolumnname ~ '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$') > That just checks for digits in the right place, it doesn't tightly > bound the range of the numbers.
Nice idea, I hadn't thought of that. It's somewhat tidier than my original experiment. I think it's about time I learnt a little more about regular expressions. I'll check it out. Thanks for your input, I appreciate it. Regards iain ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])