]
Steven Hawkins updated TEIID-4104:
----------------------------------
Summary: FORMATTIMESTAMP function is not correctly pushed down when a column is passed
as FORMAT argument (was: FORMATTIMESTAMP function is not correctly pushed down when a
colum is passed as FORMAT argument)
FORMATTIMESTAMP function is not correctly pushed down when a column
is passed as FORMAT argument
------------------------------------------------------------------------------------------------
Key: TEIID-4104
URL:
https://issues.jboss.org/browse/TEIID-4104
Project: Teiid
Issue Type: Bug
Components: Query Engine
Reporter: Salvatore R
Assignee: Steven Hawkins
Fix For: 9.0, 8.12.5, 8.13.5
I defined in PostgreSQL the following table:
{code:sql}
CREATE TABLE public.test
(
ts timestamp without time zone,
fmt character varying(100)
);
{code}
Running this query:
{code:sql}
select FORMATTIMESTAMP(ts, fmt) from pg.test;
{code}
throws the following exception:
{code}
13:44:21,778 WARN [org.teiid.CONNECTOR] (Worker3_QueryProcessorQueue19) J0VWrGay8mz0
Connector worker process failed for atomic-request=J0VWrGay8mz0.8.0.2:
org.teiid.translator.jdbc.JDBCExecutionException: 0 TEIID11008:TEIID11004 Error executing
statement(s): [Prepared Values: [] SQL: SELECT formattimestamp(g_0."ts",
g_0."fmt") FROM "public"."test" AS g_0]
at
org.teiid.translator.jdbc.JDBCQueryExecution.execute(JDBCQueryExecution.java:131)
[translator-jdbc-8.12.0.CR1.jar:8.12.0.CR1]
at
org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:349)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[rt.jar:1.7.0_67]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[rt.jar:1.7.0_67]
at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
at
org.teiid.dqp.internal.datamgr.ConnectorManager$1.invoke(ConnectorManager.java:211)
at com.sun.proxy.$Proxy47.execute(Unknown Source)
at
org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:298)
at
org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:110)
at
org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:107)
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_67]
at org.teiid.dqp.internal.process.FutureWork.run(FutureWork.java:58)
at
org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:276)
at
org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119)
at
org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[rt.jar:1.7.0_67]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[rt.jar:1.7.0_67]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
Caused by: org.postgresql.util.PSQLException: ERROR: function formattimestamp(timestamp
without time zone, character varying) does not exist
Hint: No function matches the given name and argument types. You might need to add
explicit casts.
Character: 8
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:302)
at
org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:462)
at
org.teiid.translator.jdbc.JDBCQueryExecution.execute(JDBCQueryExecution.java:123)
[translator-jdbc-8.12.0.CR1.jar:8.12.0.CR1]
... 18 more
{code}
A similar exception is thrown not only in PostgreSQL but also in other datasources like
MySQL, Oracle or Microsoft SQL Server.