sagarswathi / h2database

Automatically exported from code.google.com/p/h2database
0 stars 1 forks source link

SHOW COLUMNS FROM table_name does not work with ALLOW_LITERALS=NUMBERS #404

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
We need to modify the query in the "COLUMNS" clause of parseShow.  Using H2 
1.3.167.

Original issue reported on code.google.com by arg...@gmail.com on 7 Jun 2012 at 7:55

GoogleCodeExporter commented 8 years ago
Backtrace:

org.h2.jdbc.JdbcSQLException: Literals of this kind are not allowed; SQL 
statement:
SELECT C.COLUMN_NAME FIELD, C.TYPE_NAME || '(' || C.NUMERIC_PRECISION || ')' 
TYPE, C.IS_NULLABLE "NULL", CASE (SELECT MAX(I.INDEX_TYPE_NAME) FROM 
INFORMATION_SCHEMA.INDEXES I WHERE I.TABLE_SCHEMA=C.TABLE_SCHEMA AND 
I.TABLE_NAME=C.TABLE_NAME AND I.COLUMN_NAME=C.COLUMN_NAME)WHEN 'PRIMARY KEY' 
THEN 'PRI' WHEN 'UNIQUE INDEX' THEN 'UNI' ELSE '' END KEY, 
IFNULL(COLUMN_DEFAULT, 'NULL') DEFAULT FROM INFORMATION_SCHEMA.COLUMNS C WHERE 
C.TABLE_NAME=? AND C.TABLE_SCHEMA=? ORDER BY C.ORDINAL_POSITION [90116-167]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
    at org.h2.message.DbException.get(DbException.java:169)
    at org.h2.message.DbException.get(DbException.java:146)
    at org.h2.message.DbException.get(DbException.java:135)
    at org.h2.command.Parser.checkLiterals(Parser.java:3017)
    at org.h2.command.Parser.read(Parser.java:2983)
    at org.h2.command.Parser.readIf(Parser.java:2805)
    at org.h2.command.Parser.readConcat(Parser.java:2008)
    at org.h2.command.Parser.readCondition(Parser.java:1871)
    at org.h2.command.Parser.readAnd(Parser.java:1852)
    at org.h2.command.Parser.readExpression(Parser.java:1844)
    at org.h2.command.Parser.parseSelectSimpleSelectPart(Parser.java:1757)
    at org.h2.command.Parser.parseSelectSimple(Parser.java:1789)
    at org.h2.command.Parser.parseSelectSub(Parser.java:1684)
    at org.h2.command.Parser.parseSelectUnion(Parser.java:1527)
    at org.h2.command.Parser.parseSelect(Parser.java:1515)
    at org.h2.command.Parser.parsePrepared(Parser.java:405)
    at org.h2.command.Parser.parse(Parser.java:279)
    at org.h2.command.Parser.parse(Parser.java:251)
    at org.h2.command.Parser.prepare(Parser.java:201)
    at org.h2.engine.Session.prepare(Session.java:388)
    at org.h2.engine.Session.prepare(Session.java:375)
    at org.h2.command.Parser.prepare(Parser.java:890)
    at org.h2.command.Parser.parseShow(Parser.java:886)
    at org.h2.command.Parser.parsePrepared(Parser.java:415)
    at org.h2.command.Parser.parse(Parser.java:279)
    at org.h2.command.Parser.parse(Parser.java:251)
    at org.h2.command.Parser.prepareCommand(Parser.java:217)
    at org.h2.engine.Session.prepareLocal(Session.java:415)
    at org.h2.engine.Session.prepareCommand(Session.java:364)
    at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1111)
    at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:74)
    at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:266)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:126)
    at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:99)
    at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:58)
    at $Proxy60.prepareStatement(Unknown Source)

Original comment by arg...@gmail.com on 7 Jun 2012 at 7:58

GoogleCodeExporter commented 8 years ago
Fixed in revision 4662

Original comment by noelgrandin on 8 Feb 2013 at 8:44