Re: [SQL] Constraints for grouping

2007-09-03 Thread PostgreSQL Admin
> --- Richard Broersma Jr <[EMAIL PROTECTED]> wrote: > >> CREATE UNIQUE INDEX Only_one_row_true >> ON Your_table ( featured ) >>WHERE featured = true; >> >> Or if you want to only allow 1 featured article per catagory then: >> >> CREATE UNIQUE INDEX Only_one_row_true_per_catag

Re: [SQL] Constraints for grouping

2007-09-03 Thread Richard Broersma Jr
OOPS! --- Richard Broersma Jr <[EMAIL PROTECTED]> wrote: > CREATE UNIQUE INDEX Only_one_row_true > ON Your_table ( featured ) >WHERE featured = true; > > Or if you want to only allow 1 featured article per catagory then: > > CREATE UNIQUE INDEX Only_one_row_true_per_catagory >

Re: [SQL] Constraints for grouping

2007-09-03 Thread Richard Broersma Jr
--- PostgreSQL Admin <[EMAIL PROTECTED]> wrote: > I have a question that I've thought in my head about using triggers, but > I figure to ask people that do SQL more than I. So, I have a table that > I want two columns. > > (1) A featured column which is for only 1 row, once it switched to > anoth

Re: [SQL] Constraints...

2001-05-12 Thread Stephan Szabo
Yes. It depends on what exactly you want for the update/delete cases on permissions. I believe that in any cases you can use the check function that's used by the fk implementation to do the insert/update check on objects. If you don't mind update/deletes on permission failing if the row being