仅当列存在时,PostgreSQL仅应用过滤器
我正在构建一个应用程序,该应用程序将构建SQL查询(在Postgres中)并对其进行一些过滤。问题是,一旦在应用程序中选择过滤器后,所有查询都将接收到它,有时我们使用的表确实在过滤器中使用了列。
如果不存在列,是否有一种跳过过滤器的方法?
在伪代码类似的内容中:
SELECT * FROM table WHERE [if col exists] col > 1;
我找不到类似的东西,但也许有一些技巧。
I am building an application which will construct SQL query (in Postgres) and apply some filtering to it. The problem is, once the filter is selected in the app, all the queries are receiving it, and sometimes we use tables which do have columns used in a filter.
Is there a way to skip filter if the column does not exist?
In pseudocode something like:
SELECT * FROM table WHERE [if col exists] col > 1;
I was not able to find anything like that, but maybe there are some tricks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论