4 Replies Latest reply on Oct 21, 2013 11:57 AM by devin pinkston

    QueryParser MySQL vs PostgreSQL

    devin pinkston Newbie

      Hello,

       

      I am using the query parser to work with metadata in Teiid and I am running into an error when working with Postgres.  This process works perfectly fine with MySQL, however PostgreSQL seems to throwing an error.

       

      org.teiid.metadata.ParseException: TEIID30386 org.teiid.api.exception.query.QueryParserException: TEIID31100 Parsing error: Encountered ", conkey object[*]([*]5)" at line 1090, column 22.

      Was expecting: "default" | "not" | "options" | "primary" | "unique" | "index" | "auto_increment" | "," | ")"

        at org.teiid.query.parser.QueryParser.parseDDL(QueryParser.java:472)

        at org.teiid.query.parser.QueryParser.parseDDL(QueryParser.java:465)

        at TableParser.helpParse(TableParser.java:35)

        at TableParser.produceTable(TableParser.java:44)

        at VDBIndexer.index(VDBIndexer.java:60)

        at driver.main(driver.java:27)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:606)

        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

      Caused by: org.teiid.api.exception.query.QueryParserException: TEIID31100 Parsing error: Encountered ", conkey object[*]([*]5)" at line 1090, column 22.

      Was expecting: "default" | "not" | "options" | "primary" | "unique" | "index" | "auto_increment" | "," | ")"

        at org.teiid.query.parser.QueryParser.convertParserException(QueryParser.java:214)

        ... 11 more

       

       

       

      public static MetadataFactory helpParse(int vdbVersion, String vdbName, String ddl, String modelName) {

              MetadataFactory mf = new MetadataFactory(vdbName, vdbVersion, modelName, getDataTypes(), new Properties(), null);

              QueryParser.getQueryParser().parseDDL(mf, ddl);

              return mf;

          }

       

       

       

       

          public List<String> produceTable(String vdbName, String modelName, String ddl, int vdbVersion) {

       

       

              schema = helpParse(vdbVersion, vdbName, ddl, modelName).getSchema();

              List<String> tables = parseTableName(schema.getTables().toString());

       

       

              return tables;

       

       

          }

       

      I assume that Teiid handles the DDL/metadata of Postgres differently?

       

      Thanks