[ https://issues.apache.org/jira/browse/DERBY-6956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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.<init>(TypeDescriptorImpl.java:88) at org.apache.derby.iapi.types.DataTypeDescriptor.<init>(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][30000] 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)