如何在activejdbc中执行CTE查询?

时间:2017-11-03 06:12:08

标签: postgresql activejdbc

我需要进行公用表表达式(CTE)查询,但无法弄清楚如何在activejdbc中执行此操作。 DB是postgres 9.5

做:

Model.findbySQL("with cte as (...) select * from cte"

给我错误:

  

java.lang.IllegalArgumentException:查询必须选择'询问       在org.javalite.activejdbc.DB.find(DB.java:463)       在org.javalite.activejdbc.LazyList.hydrate(LazyList.java:329)       在org.javalite.activejdbc.LazyList.toJson(LazyList.java:245)       在com.torfiles.webservice.Endpoints.lambda $ search $ 5(Endpoints.java:91)       在spark.RouteImpl $ 1.handle(RouteImpl.java:61)       在spark.http.matching.Routes.execute(Routes.java:61)       在spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:126)       在spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50)       在org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)       在org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)       在org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119)       在org.eclipse.jetty.server.Server.handle(Server.java:517)       在org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)       在org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242)       at org.eclipse.jetty.io.AbstractConnection $ ReadCallback.succeeded(AbstractConnection.java:261)       在org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)       在org.eclipse.jetty.io.SelectChannelEndPoint $ 2.run(SelectChannelEndPoint.java:75)       at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)       at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147)       在org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)       在org.eclipse.jetty.util.thread.QueuedThreadPool $ 3.run(QueuedThreadPool.java:572)       在java.lang.Thread.run(Thread.java:748)

1 个答案:

答案 0 :(得分:1)

这是2016年4月修复的错误:https://github.com/javalite/activejdbc/issues/483 请升级到版本1.4.13以通过此操作。