Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-6367

Reference Manual incorrectly states that you can't schema-qualify constraint names

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 10.10.2.0, 10.11.1.1
    • Documentation
    • None
    • Normal

    Description

      The Reference Manual section titled "constraint-Name" incorrectly states that you can't schema-qualify the names of constraints. This is not true. What is true is that the schema name, if supplied, must be the same as the table's schema name. This behavior of Derby is correct and conforms to the SQL Standard, part 2, section 11.6 (table constraint definition), syntax rule 2. The following script shows Derby's behavior:

      connect 'jdbc:derby:memory:db;create=true';

      create schema s1;

      – fails
      create table t1
      (
      a int,
      constraint s1.c1 check ( a > 0 )
      );

      – succeeds
      create table t2
      (
      a int,
      constraint c2 check ( a > 0 )
      );

      – succeeds
      create table t3
      (
      a int,
      constraint app.c3 check ( a > 0 )
      );

      – fails because the name conflicts with an existing constraint name
      create table t4
      (
      a int,
      constraint c3 check ( a > 0 )
      );

      Attachments

        1. DERBY-6367.diff
          2 kB
          Camilla Haase
        2. rrefconstraintname.html
          3 kB
          Camilla Haase

        Activity

          People

            chaase3 Camilla Haase
            rhillegas Richard N. Hillegas
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: