这是一个很棘手的问题,谷歌,所以希望有人可以帮助我在这里。在Postgres中,您可以指定一个IN子句,如:
SELECT * FROM user WHERE id IN (1000,1001,1002)
有谁知道什么是最大数量的参数,你可以传入IN?
谢谢。
根据位于
here,starting at line 850,的源代码Postgresql没有明确限制参数的数量。
原文链接:https://www.f2er.com/postgresql/193838.html以下是第870行的代码注释:
/* * We try to generate a ScalarArrayOpExpr from IN/NOT IN,but this is only * possible if the inputs are all scalars (no RowExprs) and there is a * suitable array type available. If not,we fall back to a boolean * condition tree with multiple copies of the lefthand expression. * Also,any IN-list items that contain Vars are handled as separate * boolean conditions,because that gives the planner more scope for * optimization on such clauses. * * First step: transform all the inputs,and detect whether any are * RowExprs or contain Vars. */