Re: [GENERAL] constraint problem

2005-07-26 Thread Martín Marqués
El Lun 25 Jul 2005 23:29, Stephan Szabo escribió: > > > > Now to the constraint: > > > > I don't want the login and password columns to have nulls when the account > > (row) is confirmed (confirmed column is set to true). > > > > I tried adding this CONSTRAINT to the table definition, but with no l

Re: [GENERAL] constraint problem

2005-07-25 Thread Michael Fuhr
On Mon, Jul 25, 2005 at 08:28:32PM -0300, Martín Marqués wrote: > I tried adding this CONSTRAINT to the table definition, but with no luck: > > CONSTRAINT nonuloconfirmado CHECK > ((login NOT NULL AND password NOT NULL) OR NOT confirmado) > > It gives an error on the first NU

Re: [GENERAL] constraint problem

2005-07-25 Thread Stephan Szabo
On Mon, 25 Jul 2005, [iso-8859-1] Martín Marqués wrote: > I have a table with a login, password and confirmed columns (besides others), > and I'm having so trouble getting this contraint to work. > > The account is created with login and password NULL and confirmed set to > false. Once the user g

[GENERAL] constraint problem

2005-07-25 Thread Martín Marqués
I have a table with a login, password and confirmed columns (besides others), and I'm having so trouble getting this contraint to work. The account is created with login and password NULL and confirmed set to false. Once the user gives the app he's login and password (login is unique) the syste

Re: [GENERAL] Constraint problem

2005-03-22 Thread Tom Lane
Sean Davis <[EMAIL PROTECTED]> writes: > On Mar 22, 2005, at 7:26 AM, Szmutku Zoltán wrote: >> I would like to: server ignore the bad statements (return false) and >> after I call rollback or commit manuallypossible ? > Within a transaction, if one statement fails, all changes will be > roll

Re: [GENERAL] Constraint problem

2005-03-22 Thread Michael Fuhr
On Tue, Mar 22, 2005 at 07:41:50AM -0500, Sean Davis wrote: > > Within a transaction, if one statement fails, all changes will be > rolled back. If you want to commit each statement that works, you can > commit (or rollback) after each statement. ...or use savepoints (new in PostgreSQL 8.0).

Re: [GENERAL] Constraint problem

2005-03-22 Thread Sean Davis
On Mar 22, 2005, at 7:26 AM, Szmutku Zoltán wrote: Hi everybody ,   I try using Postgre, but  I have some problems. I create a constraint (  R1>=0 ), and after connect to server from VFP via ODBC . In the client program I turn on the transactions . (  SQLSETPROP(nHandle,'Transactions',2)   )   W

[GENERAL] Constraint problem

2005-03-22 Thread Szmutku Zoltán
Hi everybody ,   I try using Postgre, but  I have some problems. I create a constraint (  R1>=0 ), and after connect to server from VFP via ODBC . In the client program I turn on the transactions . (  SQLSETPROP(nHandle,'Transactions',2)   )   When I run UPDATE statements one after the oth

Re: [GENERAL] Constraint Problem

2003-11-05 Thread Csaba Nagy
You probably didn't quite understand the suggestion. You should create a unique index like: create unique index your_index_name on your_table (companyID, associationID) where ysnDefault; This will restrict the uniqueness checks to the records where ysnDefault is true (and not null, of course). H

Re: [GENERAL] Constraint Problem

2003-11-04 Thread Ron St-Pierre
Greg Stark wrote: Ron St-Pierre <[EMAIL PROTECTED]> writes: This is not quite what I need. I need to create a constraint to allow only -one- of company<->association<->default(=true) value but any number of company<->association<->default(=false) values So a unique index on "(compan

Re: [GENERAL] Constraint Problem

2003-11-04 Thread Greg Stark
Ron St-Pierre <[EMAIL PROTECTED]> writes: > No it doesn't. For example, after I create the unique index I can still input: > company10 association7 true > company10 association7 true > company10 association7 true > I want to prevent this from happening, but sti

Re: [GENERAL] Constraint Problem

2003-11-04 Thread Stephan Szabo
On Tue, 4 Nov 2003, Ron St-Pierre wrote: > Greg Stark wrote: > > >Ron St-Pierre <[EMAIL PROTECTED]> writes: > > > > > > > >>This is not quite what I need. I need to create a constraint to allow only > >>-one- of > >>company<->association<->default(=true) value > >>but any number of > >>com

Re: [GENERAL] Constraint Problem

2003-11-02 Thread Ron St-Pierre
Tom Lane wrote: Ron St-Pierre <[EMAIL PROTECTED]> writes: I just want to constrain the ysnDefault field to only allow one TRUE value for any companyID/associationID pair, with no restrictions on the number of FALSES. You could do that with a partial unique index. There is an example at the bo

[GENERAL] Constraint Problem

2003-11-02 Thread Ron St-Pierre
I want to create a constraint that's a little different, but don't know how to implement it. I have an intermediate table with a compound PK and a boolean 'ysnDefault' column: comanyID INTEGER REFERENCES companies, assocationID INTEGER REFERENCES associations, ysnDefault BOOLEAN I

Re: [GENERAL] Constraint Problem

2003-11-02 Thread Tom Lane
Ron St-Pierre <[EMAIL PROTECTED]> writes: > I just want to constrain the ysnDefault field to only allow one TRUE > value for any companyID/associationID pair, with no restrictions on the > number of FALSES. You could do that with a partial unique index. There is an example at the bottom of http