Re: [GENERAL] Cast character to boolean

2008-03-21 Thread Edmund.Bacon
Roberts, Jon wrote: A case statement will work just fine: select case when sub.col1 = 'y' then true else false end as col1_boolean, sub.col1 from (select cast('y' as varchar) as col1) sub Be aware of the danger here. What happens if col1 is NULL? -- Sent via pgsql-general mailing list (pgsql

[GENERAL] When does a check constraint execute?

2006-03-24 Thread Edmund.Bacon
I've been working with a time travel table as discussed in "Developing Time-Oriented Database Applications in SQL" by Richard Snodgrass. I attempted to build a constraint for a table that disallowed overlapping time itervals as follows: test=# create table test_dates (from_date date, to_date date