Increase value of OUTER_VAR

Andrei Lepikhov <a.lepikhov@postgrespro.ru>

From: Andrey Lepikhov <a.lepikhov@postgrespro.ru>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-03-03T08:29:12Z
Lists: pgsql-hackers

Attachments

Hi,

Playing with a large value of partitions I caught the limit with 65000 
table entries in a query plan:

if (IS_SPECIAL_VARNO(list_length(glob->finalrtable)))
	ereport(ERROR,
		(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
		errmsg("too many range table entries")));

Postgres works well with so many partitions.
The constants INNER_VAR, OUTER_VAR, INDEX_VAR are used as values of the 
variable 'var->varno' of integer type. As I see, they were introduced 
with commit 1054097464 authored by Marc G. Fournier, in 1996.
Value 65000 was relevant to the size of the int type at that time.

Maybe we will change these values to INT_MAX? (See the patch in attachment).

-- 
regards,
Andrey Lepikhov
Postgres Professional

Commits

  1. Remove arbitrary 64K-or-so limit on rangetable size.

  2. More cleanups of the include files