Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #521

Re: SSE 2008: Check Clause Question

From "Fred." <ghrno-google@yahoo.com>
Newsgroups comp.databases.ms-sqlserver, microsoft.public.sqlserver.programming
Subject Re: SSE 2008: Check Clause Question
Date 2011-07-14 08:22 -0700
Organization http://groups.google.com
Message-ID <ced7381f-ae1f-4a43-8954-eef5fb9f99a3@j15g2000yqf.googlegroups.com> (permalink)
References <sgap171gthveuafqqeh17jgua36k2ihp49@4ax.com> <c359ded2-0cb7-47d4-9c68-8392ab12de48@j25g2000vbr.googlegroups.com>

Cross-posted to 2 groups.

Show all headers | View raw


On Jul 14, 10:12 am, --CELKO-- <jcelko...@earthlink.net> wrote:
> On Jul 12, 3:12 pm, Gene Wirchenko <ge...@ocis.net> wrote:
>
> > Dear SQL'ers:
>
> >      Is there any way around the SQL glitch that a check condition
> > will always succeed when the table is empty?
>
> >      I do not want to have the first row be automatically accepted.
>
> > Sincerely,
>
> > Gene Wirchenko
>
> Glitch? That is a law of logic; anything you say about non-existing
> thigns is true. Look up "Existental import" in a text book on the
> history of modern logic. And teh first row is not always accepted.
>
>  I have some situations with self-references to avoid gaps in the
> dates of a history that I start with CHECK() constraints off, insert a
> first row, turn teh DRI back on and proceed to insert as usual.

That is not quite accurate. In an empty universe all universally
quantified propositions are true.  But, all existentially quantified
propositions are false.

The assetion thet the table t is not empty could be reporesnted as (Ex)
(x in t & x=x).  However, constraints are always universally
quantified over the table. A constraint C(x) on the table t is
interpreted as (x) (If x in t then C(x)).

If we apply the non-empty assertion as a constraint it will be
interpreted as (y)(If y in t then (Ex)(x in t & x=x)), which is, of
course, true if the table is empty, even though the consequent we
thought we were testing, (Ex)(x in t & x=x) is false.

I believe that there is a glitch, but it is in the documentation which
fails to document the underlying logic of the SQL constructs, probably
on the conflicting grounds that it is (1) intuitively obvious, and (2)
confusing.

Fred.

Fred.

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

SSE 2008: Check Clause Question Gene Wirchenko <genew@ocis.net> - 2011-07-12 13:12 -0700
  Re: SSE 2008: Check Clause Question Erland Sommarskog <esquel@sommarskog.se> - 2011-07-12 23:56 +0200
    Re: SSE 2008: Check Clause Question Gene Wirchenko <genew@ocis.net> - 2011-07-12 15:47 -0700
      Re: SSE 2008: Check Clause Question Erland Sommarskog <esquel@sommarskog.se> - 2011-07-13 10:17 +0200
  Re: SSE 2008: Check Clause Question --CELKO-- <jcelko212@earthlink.net> - 2011-07-14 07:06 -0700
  Re: SSE 2008: Check Clause Question --CELKO-- <jcelko212@earthlink.net> - 2011-07-14 07:12 -0700
    Re: SSE 2008: Check Clause Question "Fred." <ghrno-google@yahoo.com> - 2011-07-14 08:22 -0700
    Re: SSE 2008: Check Clause Question Gene Wirchenko <genew@ocis.net> - 2011-07-14 15:26 -0700
      Re: SSE 2008: Check Clause Question Erland Sommarskog <esquel@sommarskog.se> - 2011-07-15 10:58 +0200
        Re: SSE 2008: Check Clause Question Gene Wirchenko <genew@ocis.net> - 2011-07-15 11:07 -0700
      Re: SSE 2008: Check Clause Question --CELKO-- <jcelko212@earthlink.net> - 2011-07-16 06:46 -0700

csiph-web