db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-3043) 'Schema <schemaname> does not exist' when constraint used in table definition
Date Thu, 30 Oct 2008 03:25:44 GMT

     [ https://issues.apache.org/jira/browse/DERBY-3043?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Bryan Pendleton updated DERBY-3043:
-----------------------------------

    Attachment: tempTableTest.diff

I tried writing a test which combined CHECK constraints with
temporary tables, and attached it as 'tempTableTest.diff'.

The test fails because CHECK constraints are disallowed for
temporary tables by this code at line 412 of CheckTableNode.java:

        //temp tables can't have primary key or check or foreign key or unique constraints
defined on them
        if ((tableType == TableDescriptor.GLOBAL_TEMPORARY_TABLE_TYPE) &&
            (numPrimaryKeys > 0 || numCheckConstraints > 0 || numReferenceConstraints
> 0 || numUniqueConstraints > 0))
                throw StandardException.newException(SQLState.LANG_NOT_ALLOWED_FOR_DECLARED_GLOBAL_TEMP_TABLE);

This code rejects the CHECK constraint before we get
to the point of attempting to bind the constraint expressions
to the table, so the DERBY-3094 issue never arises for temp tables.

So, I'm not entirely sure how to proceed. Here are some possibilities:

1) Leave things alone, since the current code doesn't appear to suffer
from a problem with respect to the DERBY-3266 privilege checks
2) change the getSchemaDescriptor() call added by this patch to match
the format used in the DERBY-3266 patch, to be more consistent with
the code elsewhere in CheckTableNode.java
3) Add some additional tests (not quite sure what tests would be most helpful)

I see that DeclareGlobalTempTableJavaTest.java already includes
a test which verifies that check constraints are not allowed for
temp tables, so I don't think that the attached temptableTest.diff adds
anything to the overall test coverage.


> 'Schema <schemaname> does not exist' when constraint used in table definition
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-3043
>                 URL: https://issues.apache.org/jira/browse/DERBY-3043
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4
>         Environment: Mac OS 10
>            Reporter: geoff hendrey
>            Assignee: Bryan Pendleton
>             Fix For: 10.4.2.1, 10.5.0.0
>
>         Attachments: reorderWorkaroundTests.diff, setSchemaName.diff, tempTableTest.diff,
withSimpleTest.diff
>
>
> https://issues.apache.org/jira/browse/DERBY-568#action_12524420
> In the response to my original comment post, which you can find via the permalink above,
I was encouraged to file this as a new issue.
> verified this back to 10.1.2.1 with the following ij script.
> connect 'jdbc:derby:wombat;create=true;user=blogs';
> CREATE TABLE BLOGSCOM__BLOGS__USERS(PK INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY,username
VARCHAR(16) NOT NULL CONSTRAINT BLOGSCOM__BLOGS__USERS_UNIQUE_username UNIQUE CONSTRAINT BLOGSCOM__BLOGS__USERS_PASSWORD_username
CHECK(LENGTH(username)>7),password VARCHAR (32672) NOT NULL , PRIMARY KEY(PK));

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message