1 library(cql/cql): CQL - Constraint Query Language
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • Constraint Query Language A high level interface to SQL databases
        • library(cql/cql): CQL - Constraint Query Language
          • Warnings from CQL
          • CQL: Retrieved nulls have special logic to handle outer joins
          • CQL: Getting Started Quickly
          • Debugging CQL queries
          • Prolog Variables in CQL queries
          • CQL Special Attributes
          • CQL Examples
          • CQL: Hooks

1.2 CQL: Retrieved nulls have special logic to handle outer joins

In the course of executing a select query, the following rules are applied:

  1. Any selected attribute that is null does not bind its associated variable.
  2. Just before returning from the query any select variables that are still free are bound to {null}.

This is so we can handle outer joins. Consider this:

x :: [a-A] *== y :: [a-A]

Assume x.a binds A to a non-null value. If there is no matching row in y, then y.a = null. If variable A was truly shared the query could never succeed. By not binding the variable associated with y.a the query can succeed ( rule 1) and A will be bound to the value in x.a.