[jira] [Commented] (DERBY-6956) Create table as Select cannot copy Decimal columns

2017-08-14 Thread Bryan Pendleton (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-6956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16126786#comment-16126786
 ] 

Bryan Pendleton commented on DERBY-6956:


To summarize: my opinion is that DERBY-836 and DERBY-2605 interacted to create 
this problem.

DERBY-836 means that sometimes the maximum width is "illegal", and DERBY-2605 
added the check that we should not create a new table with a column of 
"illegal" maximum width.

Rick, what do you think?

> Create table as Select cannot copy Decimal columns
> --
>
> Key: DERBY-6956
> URL: https://issues.apache.org/jira/browse/DERBY-6956
> Project: Derby
>  Issue Type: Bug
>  Components: JDBC, SQL
>Affects Versions: 10.13.1.1
> Environment: Windows 7, DataGrip
>Reporter: Murat Cengiz
>  Labels: newbie
>
> I create a test table with the following query:
> CREATE TABLE "DERBYTEST" ("STRINGCOLUMN" varchar(255), "INTEGERCOLUMN" 
> integer, "SHORTCOLUMN" varchar(255), "LONGCOLUMN" bigint, "DOUBLECOLUMN" 
> double, "FLOATCOLUMN" double, "DECIMALCOLUMN" decimal(31, 6), "BOOLEANCOLUMN" 
> smallint, "DATECOLUMN" timestamp, "DATETIMECOLUMN" timestamp, "ID" integer, 
> "LASTMODTIME" timestamp, PRIMARY KEY ("ID"))
> this query completes successfully
> I later try to copy the table with the following query:
> CREATE TABLE "DERBYTEST_TEMP" AS SELECT * FROM DERBYTEST WITH NO DATA
> This throws the following exception:
> [42X71][3] Invalid data type 'DECIMAL(31, 6)' for column 'DECIMALCOLUMN'
> Everything works perfectly fine if I remove the decimal column.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (DERBY-6956) Create table as Select cannot copy Decimal columns

2017-08-14 Thread Bryan Pendleton (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-6956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16126784#comment-16126784
 ] 

Bryan Pendleton commented on DERBY-6956:


I suspect that this code in sqlgrammar.jj is the source of the extra 2 bytes in 
the maximum width:


{code:java}
/*
** If we have a decimal point, need to count it
** towards maxwidth.  Max width needs to account
** for the possible leading '0' and '-' and the
** decimal point.  e.g., DEC(1,1) has a maxwidth
** of 4 (to handle "-0.1").
*/
maxWidth = DataTypeUtilities.computeMaxWidth( precision, scale);
{code}

This is further confirmed by looking at this code in DataTypeUtilities.java:


{code:java}
public static int computeMaxWidth( int precision, int scale)
{
// There are 3 possible cases with respect to finding the correct max
// width for DECIMAL type.
// 1. If scale = 0, only sign should be added to precision.
// 2. scale=precision, 3 should be added to precision for sign, decimal and 
an additional char '0'.
// 3. precision > scale > 0, 2 should be added to precision for sign and 
decimal.
return (scale ==0) ? (precision +1) : ((scale == precision) ? (precision + 
3) : (precision + 2));
}
{code}

And that code in DataTypeUtilities, in turn, goes back to DERBY-836.

> Create table as Select cannot copy Decimal columns
> --
>
> Key: DERBY-6956
> URL: https://issues.apache.org/jira/browse/DERBY-6956
> Project: Derby
>  Issue Type: Bug
>  Components: JDBC, SQL
>Affects Versions: 10.13.1.1
> Environment: Windows 7, DataGrip
>Reporter: Murat Cengiz
>  Labels: newbie
>
> I create a test table with the following query:
> CREATE TABLE "DERBYTEST" ("STRINGCOLUMN" varchar(255), "INTEGERCOLUMN" 
> integer, "SHORTCOLUMN" varchar(255), "LONGCOLUMN" bigint, "DOUBLECOLUMN" 
> double, "FLOATCOLUMN" double, "DECIMALCOLUMN" decimal(31, 6), "BOOLEANCOLUMN" 
> smallint, "DATECOLUMN" timestamp, "DATETIMECOLUMN" timestamp, "ID" integer, 
> "LASTMODTIME" timestamp, PRIMARY KEY ("ID"))
> this query completes successfully
> I later try to copy the table with the following query:
> CREATE TABLE "DERBYTEST_TEMP" AS SELECT * FROM DERBYTEST WITH NO DATA
> This throws the following exception:
> [42X71][3] Invalid data type 'DECIMAL(31, 6)' for column 'DECIMALCOLUMN'
> Everything works perfectly fine if I remove the decimal column.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (DERBY-6956) Create table as Select cannot copy Decimal columns

2017-08-14 Thread Bryan Pendleton (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-6956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16126781#comment-16126781
 ] 

Bryan Pendleton commented on DERBY-6956:


The stack trace at the moment that CREATE TABLE AS SELECT decides to create a 
new decimal type of maximum width 33 is: 


{code:java}
at 
org.apache.derby.catalog.types.TypeDescriptorImpl.(TypeDescriptorImpl.java:88)
at 
org.apache.derby.iapi.types.DataTypeDescriptor.(DataTypeDescriptor.java:450)
at 
org.apache.derby.impl.sql.compile.SQLParser.getDataTypeServices(SQLParser.java:203)
at 
org.apache.derby.impl.sql.compile.SQLParser.exactNumericType(SQLParser.java:3855)
at 
org.apache.derby.impl.sql.compile.SQLParser.numericType(SQLParser.java:3763)
at 
org.apache.derby.impl.sql.compile.SQLParser.dataTypeCommon(SQLParser.java:3445)
at 
org.apache.derby.impl.sql.compile.SQLParser.dataTypeDDL(SQLParser.java:3381)
at 
org.apache.derby.impl.sql.compile.SQLParser.columnDefinition(SQLParser.java:3247)
at 
org.apache.derby.impl.sql.compile.SQLParser.tableElement(SQLParser.java:3212)
at 
org.apache.derby.impl.sql.compile.SQLParser.tableElementList(SQLParser.java:3199)
at 
org.apache.derby.impl.sql.compile.SQLParser.tableDefinition(SQLParser.java:10274)
at 
org.apache.derby.impl.sql.compile.SQLParser.createStatements(SQLParser.java:2029)
at 
org.apache.derby.impl.sql.compile.SQLParser.StatementPart(SQLParser.java:1923)
at 
org.apache.derby.impl.sql.compile.SQLParser.Statement(SQLParser.java:1823)
at 
org.apache.derby.impl.sql.compile.ParserImpl.parseStatementOrSearchCondition(ParserImpl.java:170)
at 
org.apache.derby.impl.sql.compile.ParserImpl.parseStatement(ParserImpl.java:130)
at 
org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:359)
at 
org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:99)
at 
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:1114)
at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:689)
at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:637)
at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:372)
at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:533)
at 
org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:375)
at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:251)
at org.apache.derby.impl.tools.ij.Main.go(Main.java:229)
at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184)
at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
at org.apache.derby.tools.ij.main(ij.java:59)
{code}


> Create table as Select cannot copy Decimal columns
> --
>
> Key: DERBY-6956
> URL: https://issues.apache.org/jira/browse/DERBY-6956
> Project: Derby
>  Issue Type: Bug
>  Components: JDBC, SQL
>Affects Versions: 10.13.1.1
> Environment: Windows 7, DataGrip
>Reporter: Murat Cengiz
>  Labels: newbie
>
> I create a test table with the following query:
> CREATE TABLE "DERBYTEST" ("STRINGCOLUMN" varchar(255), "INTEGERCOLUMN" 
> integer, "SHORTCOLUMN" varchar(255), "LONGCOLUMN" bigint, "DOUBLECOLUMN" 
> double, "FLOATCOLUMN" double, "DECIMALCOLUMN" decimal(31, 6), "BOOLEANCOLUMN" 
> smallint, "DATECOLUMN" timestamp, "DATETIMECOLUMN" timestamp, "ID" integer, 
> "LASTMODTIME" timestamp, PRIMARY KEY ("ID"))
> this query completes successfully
> I later try to copy the table with the following query:
> CREATE TABLE "DERBYTEST_TEMP" AS SELECT * FROM DERBYTEST WITH NO DATA
> This throws the following exception:
> [42X71][3] Invalid data type 'DECIMAL(31, 6)' for column 'DECIMALCOLUMN'
> Everything works perfectly fine if I remove the decimal column.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (DERBY-6956) Create table as Select cannot copy Decimal columns

2017-08-14 Thread Rick Hillegas (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-6956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16126720#comment-16126720
 ] 

Rick Hillegas commented on DERBY-6956:
--

The CREATE TABLE AS SELECT statement fails because we flunk the following 
check...

(getMaximumWidth() <= typeId.getMaximumMaximumWidth());

at line 1859 in DataTypeDescriptor.java. That, in turn is because the maximum 
width accounts for a sign byte and a decimal point byte in addition to the 
maximum number of digits in the decimal. I don't know yet why that check is 
necessary.

> Create table as Select cannot copy Decimal columns
> --
>
> Key: DERBY-6956
> URL: https://issues.apache.org/jira/browse/DERBY-6956
> Project: Derby
>  Issue Type: Bug
>  Components: JDBC, SQL
>Affects Versions: 10.13.1.1
> Environment: Windows 7, DataGrip
>Reporter: Murat Cengiz
>  Labels: newbie
>
> I create a test table with the following query:
> CREATE TABLE "DERBYTEST" ("STRINGCOLUMN" varchar(255), "INTEGERCOLUMN" 
> integer, "SHORTCOLUMN" varchar(255), "LONGCOLUMN" bigint, "DOUBLECOLUMN" 
> double, "FLOATCOLUMN" double, "DECIMALCOLUMN" decimal(31, 6), "BOOLEANCOLUMN" 
> smallint, "DATECOLUMN" timestamp, "DATETIMECOLUMN" timestamp, "ID" integer, 
> "LASTMODTIME" timestamp, PRIMARY KEY ("ID"))
> this query completes successfully
> I later try to copy the table with the following query:
> CREATE TABLE "DERBYTEST_TEMP" AS SELECT * FROM DERBYTEST WITH NO DATA
> This throws the following exception:
> [42X71][3] Invalid data type 'DECIMAL(31, 6)' for column 'DECIMALCOLUMN'
> Everything works perfectly fine if I remove the decimal column.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (DERBY-6956) Create table as Select cannot copy Decimal columns

2017-08-14 Thread Bryan Pendleton (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-6956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16126715#comment-16126715
 ] 

Bryan Pendleton commented on DERBY-6956:


And in the particular code path tickled by the CREATE TABLE AS SELECT 
statement, in the code:


{code:java}
public boolean isUserCreatableType() throws StandardException
{
switch (typeId.getJDBCTypeId())
{
case Types.JAVA_OBJECT:
return getTypeId().getBaseTypeId().isAnsiUDT();
case Types.DECIMAL:
return
(getPrecision() <= typeId.getMaximumPrecision()) &&
(getScale() <= typeId.getMaximumScale()) &&
(getMaximumWidth() <= typeId.getMaximumMaximumWidth());
default: break;
}
return true;
}
{code}

the problem is that getMaximumWidth() returns 33, which is larger than the 31 
limit for DECIMAL.

So, somehow, the statement thinks it's trying to create a field of width 33, 
even though the source table is DECIMAL(31,6).

And, sure enough, if I change the repro so that the DECIMALCOLUMN column is 
DECIMAL(29,6), the test passes and the error is not thrown.


> Create table as Select cannot copy Decimal columns
> --
>
> Key: DERBY-6956
> URL: https://issues.apache.org/jira/browse/DERBY-6956
> Project: Derby
>  Issue Type: Bug
>  Components: JDBC, SQL
>Affects Versions: 10.13.1.1
> Environment: Windows 7, DataGrip
>Reporter: Murat Cengiz
>  Labels: newbie
>
> I create a test table with the following query:
> CREATE TABLE "DERBYTEST" ("STRINGCOLUMN" varchar(255), "INTEGERCOLUMN" 
> integer, "SHORTCOLUMN" varchar(255), "LONGCOLUMN" bigint, "DOUBLECOLUMN" 
> double, "FLOATCOLUMN" double, "DECIMALCOLUMN" decimal(31, 6), "BOOLEANCOLUMN" 
> smallint, "DATECOLUMN" timestamp, "DATETIMECOLUMN" timestamp, "ID" integer, 
> "LASTMODTIME" timestamp, PRIMARY KEY ("ID"))
> this query completes successfully
> I later try to copy the table with the following query:
> CREATE TABLE "DERBYTEST_TEMP" AS SELECT * FROM DERBYTEST WITH NO DATA
> This throws the following exception:
> [42X71][3] Invalid data type 'DECIMAL(31, 6)' for column 'DECIMALCOLUMN'
> Everything works perfectly fine if I remove the decimal column.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (DERBY-6956) Create table as Select cannot copy Decimal columns

2017-08-14 Thread Bryan Pendleton (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-6956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16126710#comment-16126710
 ] 

Bryan Pendleton commented on DERBY-6956:


DataTypeDescriptor.isUserCreatableType was added by DERBY-2605, and dealt with 
the problem described here: 
http://article.gmane.org/gmane.comp.apache.db.derby.devel/40881



> Create table as Select cannot copy Decimal columns
> --
>
> Key: DERBY-6956
> URL: https://issues.apache.org/jira/browse/DERBY-6956
> Project: Derby
>  Issue Type: Bug
>  Components: JDBC, SQL
>Affects Versions: 10.13.1.1
> Environment: Windows 7, DataGrip
>Reporter: Murat Cengiz
>  Labels: newbie
>
> I create a test table with the following query:
> CREATE TABLE "DERBYTEST" ("STRINGCOLUMN" varchar(255), "INTEGERCOLUMN" 
> integer, "SHORTCOLUMN" varchar(255), "LONGCOLUMN" bigint, "DOUBLECOLUMN" 
> double, "FLOATCOLUMN" double, "DECIMALCOLUMN" decimal(31, 6), "BOOLEANCOLUMN" 
> smallint, "DATECOLUMN" timestamp, "DATETIMECOLUMN" timestamp, "ID" integer, 
> "LASTMODTIME" timestamp, PRIMARY KEY ("ID"))
> this query completes successfully
> I later try to copy the table with the following query:
> CREATE TABLE "DERBYTEST_TEMP" AS SELECT * FROM DERBYTEST WITH NO DATA
> This throws the following exception:
> [42X71][3] Invalid data type 'DECIMAL(31, 6)' for column 'DECIMALCOLUMN'
> Everything works perfectly fine if I remove the decimal column.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (DERBY-6956) Create table as Select cannot copy Decimal columns

2017-08-14 Thread Bryan Pendleton (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-6956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16126706#comment-16126706
 ] 

Bryan Pendleton commented on DERBY-6956:


Reproduces for me with the head of trunk.

The stack trace is:

{code:java}
Mon Aug 14 18:35:53 PDT 2017 Thread[main,5,main] (XID = 168), (SESSIONID = 1), 
(DATABASE = memory:test), (DRDAID = null)
, Failed Statement is: CREATE TABLE "DERBYTEST_TEMP" AS SELECT * FROM DERBYTEST 
WITH NO DATA^M
ERROR 42X71: Invalid data type 'DECIMAL(31, 6)' for column 'DECIMALCOLUMN'.
at 
org.apache.derby.iapi.error.StandardException.newException(StandardException.java:290)
at 
org.apache.derby.iapi.error.StandardException.newException(StandardException.java:285)
at 
org.apache.derby.impl.sql.compile.CreateTableNode.bindStatement(CreateTableNode.java:338)
at 
org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:401)
at 
org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:99)
at 
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:1114)
at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:689)
at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:637)
at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:372)
at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:533)
at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:375)
at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:251)
at org.apache.derby.impl.tools.ij.Main.go(Main.java:229)
at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184)
at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
at org.apache.derby.tools.ij.main(ij.java:59)
{code}

And line 338 of CreateTableNode.java is this "if" statement:

{code:java}
DataTypeDescriptor dtd = 
rc.getExpression().getTypeServices();
if ((dtd != null) && !dtd.isUserCreatableType())
{
throw StandardException.newException(

SQLState.LANG_INVALID_COLUMN_TYPE_CREATE_TABLE,

dtd.getFullSQLTypeName(),
rc.getName());
}
{code}

This appears to indicate that dtd.isUserCreatableType() returned false for the 
DECIMAL(31,6) data type column.

> Create table as Select cannot copy Decimal columns
> --
>
> Key: DERBY-6956
> URL: https://issues.apache.org/jira/browse/DERBY-6956
> Project: Derby
>  Issue Type: Bug
>  Components: JDBC, SQL
>Affects Versions: 10.13.1.1
> Environment: Windows 7, DataGrip
>Reporter: Murat Cengiz
>  Labels: newbie
>
> I create a test table with the following query:
> CREATE TABLE "DERBYTEST" ("STRINGCOLUMN" varchar(255), "INTEGERCOLUMN" 
> integer, "SHORTCOLUMN" varchar(255), "LONGCOLUMN" bigint, "DOUBLECOLUMN" 
> double, "FLOATCOLUMN" double, "DECIMALCOLUMN" decimal(31, 6), "BOOLEANCOLUMN" 
> smallint, "DATECOLUMN" timestamp, "DATETIMECOLUMN" timestamp, "ID" integer, 
> "LASTMODTIME" timestamp, PRIMARY KEY ("ID"))
> this query completes successfully
> I later try to copy the table with the following query:
> CREATE TABLE "DERBYTEST_TEMP" AS SELECT * FROM DERBYTEST WITH NO DATA
> This throws the following exception:
> [42X71][3] Invalid data type 'DECIMAL(31, 6)' for column 'DECIMALCOLUMN'
> Everything works perfectly fine if I remove the decimal column.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (DERBY-6956) Create table as Select cannot copy Decimal columns

2017-08-14 Thread klement (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-6956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16125830#comment-16125830
 ] 

klement commented on DERBY-6956:


Urgent! I'm facing the same issue.

> Create table as Select cannot copy Decimal columns
> --
>
> Key: DERBY-6956
> URL: https://issues.apache.org/jira/browse/DERBY-6956
> Project: Derby
>  Issue Type: Bug
>  Components: JDBC, SQL
>Affects Versions: 10.13.1.1
> Environment: Windows 7, DataGrip
>Reporter: Murat Cengiz
>  Labels: newbie
>
> I create a test table with the following query:
> CREATE TABLE "DERBYTEST" ("STRINGCOLUMN" varchar(255), "INTEGERCOLUMN" 
> integer, "SHORTCOLUMN" varchar(255), "LONGCOLUMN" bigint, "DOUBLECOLUMN" 
> double, "FLOATCOLUMN" double, "DECIMALCOLUMN" decimal(31, 6), "BOOLEANCOLUMN" 
> smallint, "DATECOLUMN" timestamp, "DATETIMECOLUMN" timestamp, "ID" integer, 
> "LASTMODTIME" timestamp, PRIMARY KEY ("ID"))
> this query completes successfully
> I later try to copy the table with the following query:
> CREATE TABLE "DERBYTEST_TEMP" AS SELECT * FROM DERBYTEST WITH NO DATA
> This throws the following exception:
> [42X71][3] Invalid data type 'DECIMAL(31, 6)' for column 'DECIMALCOLUMN'
> Everything works perfectly fine if I remove the decimal column.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (DERBY-6956) Create table as Select cannot copy Decimal columns

2017-08-14 Thread Murat Cengiz (JIRA)

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

Murat Cengiz updated DERBY-6956:

Description: 
I create a test table with the following query:

CREATE TABLE "DERBYTEST" ("STRINGCOLUMN" varchar(255), "INTEGERCOLUMN" integer, 
"SHORTCOLUMN" varchar(255), "LONGCOLUMN" bigint, "DOUBLECOLUMN" double, 
"FLOATCOLUMN" double, "DECIMALCOLUMN" decimal(31, 6), "BOOLEANCOLUMN" smallint, 
"DATECOLUMN" timestamp, "DATETIMECOLUMN" timestamp, "ID" integer, "LASTMODTIME" 
timestamp, PRIMARY KEY ("ID"))

this query completes successfully

I later try to copy the table with the following query:

CREATE TABLE "DERBYTEST_TEMP" AS SELECT * FROM DERBYTEST WITH NO DATA

This throws the following exception:

[42X71][3] Invalid data type 'DECIMAL(31, 6)' for column 'DECIMALCOLUMN'

Everything works perfectly fine if I remove the decimal column.

  was:
I create a test table with the following query:

CREATE TABLE "DERBYTEST" ("STRINGCOLUMN" varchar(255), "INTEGERCOLUMN" integer, 
"SHORTCOLUMN" varchar(255), "LONGCOLUMN" bigint, "DOUBLECOLUMN" double, 
"FLOATCOLUMN" double, "DECIMALCOLUMN" decimal(31, 6), "BOOLEANCOLUMN" smallint, 
"DATECOLUMN" timestamp, "DATETIMECOLUMN" timestamp, "ID" integer, "LASTMODTIME" 
timestamp, PRIMARY KEY ("ID"))

this query completes successfully

I later try to copy the table with the following query:

CREATE TABLE "DERBYTEST_TEMP" AS SELECT * FROM DERBYTEST WITH NO DATA

This throws the following exception:

[42X71][3] Invalid data type 'DECIMAL(31, 6)' for column 'DECIMALCOLUMN'


> Create table as Select cannot copy Decimal columns
> --
>
> Key: DERBY-6956
> URL: https://issues.apache.org/jira/browse/DERBY-6956
> Project: Derby
>  Issue Type: Bug
>  Components: JDBC, SQL
>Affects Versions: 10.13.1.1
> Environment: Windows 7, DataGrip
>Reporter: Murat Cengiz
>  Labels: newbie
>
> I create a test table with the following query:
> CREATE TABLE "DERBYTEST" ("STRINGCOLUMN" varchar(255), "INTEGERCOLUMN" 
> integer, "SHORTCOLUMN" varchar(255), "LONGCOLUMN" bigint, "DOUBLECOLUMN" 
> double, "FLOATCOLUMN" double, "DECIMALCOLUMN" decimal(31, 6), "BOOLEANCOLUMN" 
> smallint, "DATECOLUMN" timestamp, "DATETIMECOLUMN" timestamp, "ID" integer, 
> "LASTMODTIME" timestamp, PRIMARY KEY ("ID"))
> this query completes successfully
> I later try to copy the table with the following query:
> CREATE TABLE "DERBYTEST_TEMP" AS SELECT * FROM DERBYTEST WITH NO DATA
> This throws the following exception:
> [42X71][3] Invalid data type 'DECIMAL(31, 6)' for column 'DECIMALCOLUMN'
> Everything works perfectly fine if I remove the decimal column.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (DERBY-6956) Create table as Select cannot copy Decimal columns

2017-08-14 Thread Murat Cengiz (JIRA)

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

Murat Cengiz updated DERBY-6956:

Summary: Create table as Select cannot copy Decimal columns  (was: Create 
table as Select cannot )

> Create table as Select cannot copy Decimal columns
> --
>
> Key: DERBY-6956
> URL: https://issues.apache.org/jira/browse/DERBY-6956
> Project: Derby
>  Issue Type: Bug
>  Components: JDBC, SQL
>Affects Versions: 10.13.1.1
> Environment: Windows 7, DataGrip
>Reporter: Murat Cengiz
>  Labels: newbie
>
> I create a test table with the following query:
> CREATE TABLE "DERBYTEST" ("STRINGCOLUMN" varchar(255), "INTEGERCOLUMN" 
> integer, "SHORTCOLUMN" varchar(255), "LONGCOLUMN" bigint, "DOUBLECOLUMN" 
> double, "FLOATCOLUMN" double, "DECIMALCOLUMN" decimal(31, 6), "BOOLEANCOLUMN" 
> smallint, "DATECOLUMN" timestamp, "DATETIMECOLUMN" timestamp, "ID" integer, 
> "LASTMODTIME" timestamp, PRIMARY KEY ("ID"))
> this query completes successfully
> I later try to copy the table with the following query:
> CREATE TABLE "DERBYTEST_TEMP" AS SELECT * FROM DERBYTEST WITH NO DATA
> This throws the following exception:
> [42X71][3] Invalid data type 'DECIMAL(31, 6)' for column 'DECIMALCOLUMN'



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Created] (DERBY-6956) Create table as Select cannot

2017-08-14 Thread Murat Cengiz (JIRA)
Murat Cengiz created DERBY-6956:
---

 Summary: Create table as Select cannot 
 Key: DERBY-6956
 URL: https://issues.apache.org/jira/browse/DERBY-6956
 Project: Derby
  Issue Type: Bug
  Components: JDBC, SQL
Affects Versions: 10.13.1.1
 Environment: Windows 7, DataGrip
Reporter: Murat Cengiz


I create a test table with the following query:

CREATE TABLE "DERBYTEST" ("STRINGCOLUMN" varchar(255), "INTEGERCOLUMN" integer, 
"SHORTCOLUMN" varchar(255), "LONGCOLUMN" bigint, "DOUBLECOLUMN" double, 
"FLOATCOLUMN" double, "DECIMALCOLUMN" decimal(31, 6), "BOOLEANCOLUMN" smallint, 
"DATECOLUMN" timestamp, "DATETIMECOLUMN" timestamp, "ID" integer, "LASTMODTIME" 
timestamp, PRIMARY KEY ("ID"))

this query completes successfully

I later try to copy the table with the following query:

CREATE TABLE "DERBYTEST_TEMP" AS SELECT * FROM DERBYTEST WITH NO DATA

This throws the following exception:

[42X71][3] Invalid data type 'DECIMAL(31, 6)' for column 'DECIMALCOLUMN'



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)