You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Gin Ng (JIRA)" <de...@db.apache.org> on 2005/05/31 21:02:53 UTC

[jira] Created: (DERBY-331) create table fails when a constraint defintion follows a column default

create table fails when a constraint defintion follows a column default
-----------------------------------------------------------------------

         Key: DERBY-331
         URL: http://issues.apache.org/jira/browse/DERBY-331
     Project: Derby
        Type: Bug
  Components: SQL  
    Versions: 10.0.2.1    
 Environment: Windows XP
    Reporter: Gin Ng
    Priority: Minor


The following statement fails with syntax error.

ij> create table t (a int not null, b int default 0, unique (a));
ERROR 42X01: Syntax error: Encountered "0" at line 1, column 47.

And it will work if I remove either default 0 or unique(a).


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-331) create table fails when a constraint defintion follows a column default

Posted by "Satheesh Bandaram (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-331?page=comments#action_12312960 ] 

Satheesh Bandaram commented on DERBY-331:
-----------------------------------------

That doesn't seem to be the correct syntax. Derby supports column level constraints, in the format:

ij> create table t ( a int not null unique, b int default 0);
0 rows inserted/updated/deleted

Or table level constraints, like:

ij> create table t (a int not null, b int default 0, constraint tk unique (a));
0 rows inserted/updated/deleted

See documentation at:
http://incubator.apache.org/derby/docs/ref/rrefsqlj13590.html

> create table fails when a constraint defintion follows a column default
> -----------------------------------------------------------------------
>
>          Key: DERBY-331
>          URL: http://issues.apache.org/jira/browse/DERBY-331
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.1
>  Environment: Windows XP
>     Reporter: Gin Ng
>     Priority: Minor

>
> The following statement fails with syntax error.
> ij> create table t (a int not null, b int default 0, unique (a));
> ERROR 42X01: Syntax error: Encountered "0" at line 1, column 47.
> And it will work if I remove either default 0 or unique(a).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-331) create table fails when a constraint defintion follows a column default

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-331?page=comments#action_12315325 ] 

Daniel John Debrunner commented on DERBY-331:
---------------------------------------------

Committed revision 209842 (331b.diff)
Sorry for missing this one, noticed it the other day when looking at the release notes, but didn't get back to it.

> create table fails when a constraint defintion follows a column default
> -----------------------------------------------------------------------
>
>          Key: DERBY-331
>          URL: http://issues.apache.org/jira/browse/DERBY-331
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.1
>  Environment: Windows XP
>     Reporter: Gin Ng
>     Assignee: Dag H. Wanvik
>     Priority: Minor
>  Attachments: 331b.diff, 331b.stat
>
> The following statement fails with syntax error.
> ij> create table t (a int not null, b int default 0, unique (a));
> ERROR 42X01: Syntax error: Encountered "0" at line 1, column 47.
> And it will work if I remove either default 0 or unique(a).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (DERBY-331) create table fails when a constraint defintion follows a column default

Posted by "Dag H. Wanvik (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-331?page=all ]
     
Dag H. Wanvik closed DERBY-331:
-------------------------------

    Fix Version: 10.2.0.0
     Resolution: Fixed

> create table fails when a constraint defintion follows a column default
> -----------------------------------------------------------------------
>
>          Key: DERBY-331
>          URL: http://issues.apache.org/jira/browse/DERBY-331
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.1
>  Environment: Windows XP
>     Reporter: Gin Ng
>     Assignee: Dag H. Wanvik
>     Priority: Minor
>      Fix For: 10.2.0.0
>  Attachments: 331b.diff, 331b.stat
>
> The following statement fails with syntax error.
> ij> create table t (a int not null, b int default 0, unique (a));
> ERROR 42X01: Syntax error: Encountered "0" at line 1, column 47.
> And it will work if I remove either default 0 or unique(a).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-331) create table fails when a constraint defintion follows a column default

Posted by "Mayuresh Nirhali (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-331?page=all ]

Mayuresh Nirhali updated DERBY-331:
-----------------------------------

    Fix Version: 10.1.3.0

This bug is 10.1 branch porting candidate for 10.1.3 release.

I merged the changes (209842) into my fresh 10.1 branch child. The changes applied cleanly.
I rebuilt the workspace and ran the corresponding test, lang,columnDefaults.sql. The test passed.
derbyall also did not show any relevant failures.

I think the already attached patch can be directly merg/committed to 10.1 branch.


> create table fails when a constraint defintion follows a column default
> -----------------------------------------------------------------------
>
>          Key: DERBY-331
>          URL: http://issues.apache.org/jira/browse/DERBY-331
>      Project: Derby
>         Type: Bug

>   Components: SQL
>     Versions: 10.0.2.1
>  Environment: Windows XP
>     Reporter: Gin Ng
>     Assignee: Dag H. Wanvik
>     Priority: Minor
>      Fix For: 10.2.0.0, 10.1.3.0
>  Attachments: 331b.diff, 331b.stat
>
> The following statement fails with syntax error.
> ij> create table t (a int not null, b int default 0, unique (a));
> ERROR 42X01: Syntax error: Encountered "0" at line 1, column 47.
> And it will work if I remove either default 0 or unique(a).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-331) create table fails when a constraint defintion follows a column default

Posted by "Dag H. Wanvik (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-331?page=all ]

Dag H. Wanvik updated DERBY-331:
--------------------------------

    Attachment: 331b.stat
                331b.diff

Updated this patch which additional comments, according to Mamta's suggestion.
Ran the test lang/columnDefaults.sql again to verify.



> create table fails when a constraint defintion follows a column default
> -----------------------------------------------------------------------
>
>          Key: DERBY-331
>          URL: http://issues.apache.org/jira/browse/DERBY-331
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.1
>  Environment: Windows XP
>     Reporter: Gin Ng
>     Assignee: Dag H. Wanvik
>     Priority: Minor
>  Attachments: 331b.diff, 331b.stat
>
> The following statement fails with syntax error.
> ij> create table t (a int not null, b int default 0, unique (a));
> ERROR 42X01: Syntax error: Encountered "0" at line 1, column 47.
> And it will work if I remove either default 0 or unique(a).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-331) create table fails when a constraint defintion follows a column default

Posted by "Dag H. Wanvik (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-331?page=comments#action_12313297 ] 

Dag H. Wanvik commented on DERBY-331:
-------------------------------------

This seems to be a look-ahead problem in the parser. I think I have a patch for it, just need to run all tests.


> create table fails when a constraint defintion follows a column default
> -----------------------------------------------------------------------
>
>          Key: DERBY-331
>          URL: http://issues.apache.org/jira/browse/DERBY-331
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.1
>  Environment: Windows XP
>     Reporter: Gin Ng
>     Priority: Minor

>
> The following statement fails with syntax error.
> ij> create table t (a int not null, b int default 0, unique (a));
> ERROR 42X01: Syntax error: Encountered "0" at line 1, column 47.
> And it will work if I remove either default 0 or unique(a).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-331) create table fails when a constraint defintion follows a column default

Posted by "Gin Ng (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-331?page=comments#action_12313045 ] 

Gin Ng commented on DERBY-331:
------------------------------

The constraint name is optional.  See http://incubator.apache.org/derby/docs/ref/rrefsqlj16095.html.
And my example is in the same form of the second example in the document above except the default value.

-- the table-level primary key definition allows you to
-- include two columns in the primary key definition:
CREATE TABLE SAMP.SCHED 
	(
	CLASS_CODE CHAR(7) NOT NULL, 
	DAY SMALLINT NOT NULL, 
	STARTING TIME, 
	ENDING TIME,
	PRIMARY KEY (CLASS_CODE, DAY)
	);


> create table fails when a constraint defintion follows a column default
> -----------------------------------------------------------------------
>
>          Key: DERBY-331
>          URL: http://issues.apache.org/jira/browse/DERBY-331
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.1
>  Environment: Windows XP
>     Reporter: Gin Ng
>     Priority: Minor

>
> The following statement fails with syntax error.
> ij> create table t (a int not null, b int default 0, unique (a));
> ERROR 42X01: Syntax error: Encountered "0" at line 1, column 47.
> And it will work if I remove either default 0 or unique(a).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (DERBY-331) create table fails when a constraint defintion follows a column default

Posted by "Dag H. Wanvik (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-331?page=all ]

Dag H. Wanvik reassigned DERBY-331:
-----------------------------------

    Assign To: Dag H. Wanvik

> create table fails when a constraint defintion follows a column default
> -----------------------------------------------------------------------
>
>          Key: DERBY-331
>          URL: http://issues.apache.org/jira/browse/DERBY-331
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.1
>  Environment: Windows XP
>     Reporter: Gin Ng
>     Assignee: Dag H. Wanvik
>     Priority: Minor

>
> The following statement fails with syntax error.
> ij> create table t (a int not null, b int default 0, unique (a));
> ERROR 42X01: Syntax error: Encountered "0" at line 1, column 47.
> And it will work if I remove either default 0 or unique(a).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-331) create table fails when a constraint defintion follows a column default

Posted by "Dag H. Wanvik (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-331?page=all ]

Dag H. Wanvik updated DERBY-331:
--------------------------------

    Attachment: 331.stat
                331.diff

This patch fixes a look-ahead problem in the parser: In the method DB2DefaultOption, 
the look-ahead for  miscBuiltins is too liberal: it mistakenly thinks it has found a
builtin in this case. I made the look-ahead more specific by adding a check against comma.
 I have extended the test lang/columnDefaults.sql with this case.
I have run derbyall with no errors.


> create table fails when a constraint defintion follows a column default
> -----------------------------------------------------------------------
>
>          Key: DERBY-331
>          URL: http://issues.apache.org/jira/browse/DERBY-331
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.1
>  Environment: Windows XP
>     Reporter: Gin Ng
>     Assignee: Dag H. Wanvik
>     Priority: Minor
>  Attachments: 331.diff, 331.stat
>
> The following statement fails with syntax error.
> ij> create table t (a int not null, b int default 0, unique (a));
> ERROR 42X01: Syntax error: Encountered "0" at line 1, column 47.
> And it will work if I remove either default 0 or unique(a).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (DERBY-331) create table fails when a constraint defintion follows a column default

Posted by "Knut Anders Hatlen (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-331?page=all ]
     
Knut Anders Hatlen closed DERBY-331:
------------------------------------

    Fix Version: 10.1.2.5
     Resolution: Fixed

Committed into 10.1 with revision 413299.

> create table fails when a constraint defintion follows a column default
> -----------------------------------------------------------------------
>
>          Key: DERBY-331
>          URL: http://issues.apache.org/jira/browse/DERBY-331
>      Project: Derby
>         Type: Bug

>   Components: SQL
>     Versions: 10.0.2.1
>  Environment: Windows XP
>     Reporter: Gin Ng
>     Assignee: Dag H. Wanvik
>     Priority: Minor
>      Fix For: 10.2.0.0, 10.1.3.0, 10.1.2.5
>  Attachments: 331b.diff, 331b.stat
>
> The following statement fails with syntax error.
> ij> create table t (a int not null, b int default 0, unique (a));
> ERROR 42X01: Syntax error: Encountered "0" at line 1, column 47.
> And it will work if I remove either default 0 or unique(a).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Reopened: (DERBY-331) create table fails when a constraint defintion follows a column default

Posted by "Knut Anders Hatlen (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-331?page=all ]
     
Knut Anders Hatlen reopened DERBY-331:
--------------------------------------


This issue is marked as fixed in 10.1.3.0, but it is not. Reopening to merge to the 10.1 branch.

> create table fails when a constraint defintion follows a column default
> -----------------------------------------------------------------------
>
>          Key: DERBY-331
>          URL: http://issues.apache.org/jira/browse/DERBY-331
>      Project: Derby
>         Type: Bug

>   Components: SQL
>     Versions: 10.0.2.1
>  Environment: Windows XP
>     Reporter: Gin Ng
>     Assignee: Dag H. Wanvik
>     Priority: Minor
>      Fix For: 10.2.0.0, 10.1.3.0
>  Attachments: 331b.diff, 331b.stat
>
> The following statement fails with syntax error.
> ij> create table t (a int not null, b int default 0, unique (a));
> ERROR 42X01: Syntax error: Encountered "0" at line 1, column 47.
> And it will work if I remove either default 0 or unique(a).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira