Prohibiting Cartesian Products

If you do not want to rely solely on your own tests for avoiding Cartesian products, you can set an option to prohibit Cartesian products. With this option set, each time you run a query, it is tested to determine whether or not there are join conditions between the tables. If there are no join conditions, an error results.

The test does not determine whether or not the join conditions are logical or correct for your application. However, by blocking Cartesian products in this way, you will reduce the chance that you will forget to put any join conditions on your query.

Note:

This test is only effective for queries run from within the SQLWizard. Queries embedded in host programs or executed from other programs are not affected. You may want to test your queries in SQLWizard before running them in other programs.

Another way to minimize the chance that you will generate a Cartesian product is to make use of SQLWizard's Auto Join facilities.

To prohibit (block) Cartesian products:

  1. From the Query menu, click the Current Query Options command (or, in the Micro Focus Program Group or Folder, click the Options icon).
  2. If using Options to set this item as your default, click the Query tab to access the Query options.
  3. Click the Prohibit Cartesian Products checkbox to select it.
  4. Close the Query Options dialog box (or Options window, as appropriate).

    Now when you run an SQL query in SQLWizard, it will be tested to determine if it might return a Cartesian product.