[sqlite] FOREIGN KEY enhancement request

2015-11-26 Thread Keith Medcalf
, 2015 06:57 > To: SQLite mailing list > Subject: Re: [sqlite] FOREIGN KEY enhancement request > > > On 26 Nov 2015, at 1:52pm, Bernardo Sulzbach > wrote: > > > I did not mean that. But if you want to check that a certain row has a > > valid value like you described,

[sqlite] FOREIGN KEY enhancement request

2015-11-26 Thread Simon Slavin
On 26 Nov 2015, at 1:52pm, Bernardo Sulzbach wrote: > I did not mean that. But if you want to check that a certain row has a > valid value like you described, > >check ((job='dealer' or job='agent') or can_discount='no') That works only when the "job" column is in the table the

[sqlite] FOREIGN KEY enhancement request

2015-11-26 Thread Simon Slavin
On 26 Nov 2015, at 1:36pm, Bernardo Sulzbach wrote: > I am not against this feature request, Simon. But enlighten my why > this cannot be done with a CHECK constraint? I may be missing > something very simple. Thanks. Can you refer to another table in a CHECK constraint ? It never occurred

[sqlite] FOREIGN KEY enhancement request

2015-11-26 Thread Simon Slavin
On 26 Nov 2015, at 7:42am, nomad at null.net wrote: > Which column in the customers table should contain the fixed value or > expression? The items listed in the REFERENCES clause should be handled in the same order as they would if they were all column names. It's just that instead of

[sqlite] FOREIGN KEY enhancement request

2015-11-26 Thread Bernardo Sulzbach
Oh, OK. I thought they were in the same table. On Thu, Nov 26, 2015 at 11:56 AM, Simon Slavin wrote: > > On 26 Nov 2015, at 1:52pm, Bernardo Sulzbach > wrote: > >> I did not mean that. But if you want to check that a certain row has a >> valid value like you described, >> >>check

[sqlite] FOREIGN KEY enhancement request

2015-11-26 Thread Bernardo Sulzbach
I did not mean that. But if you want to check that a certain row has a valid value like you described, check ((job='dealer' or job='agent') or can_discount='no') Could do the trick, right? If you want, you can be more aggressive and go for check can_discount='no' or ((job='dealer' or

[sqlite] FOREIGN KEY enhancement request

2015-11-26 Thread Bernardo Sulzbach
I am not against this feature request, Simon. But enlighten my why this cannot be done with a CHECK constraint? I may be missing something very simple. Thanks.

[sqlite] FOREIGN KEY enhancement request

2015-11-26 Thread no...@null.net
On Wed Nov 25, 2015 at 10:45:07AM +, Simon Slavin wrote: > > REFERENCES foreign-table ( column-name [[, column-name]]) ... > > It would be useful if rather than having to specify a column name for > each item one could specify a fixed value (or perhaps an expression, > though that might be

[sqlite] FOREIGN KEY enhancement request

2015-11-25 Thread Simon Slavin
I request an enhancement to FOREIGN KEYs as follows. The foreign key clause requires a definition as follows: REFERENCES foreign-table ( column-name [[, column-name]]) ... It would be useful if rather than having to specify a column name