1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-27 07:42:10 +03:00

Change LIMIT/OFFSET to use int8

Dhanaraj M
This commit is contained in:
Bruce Momjian
2006-07-26 00:34:48 +00:00
parent 796de9c1ed
commit 085e559654
8 changed files with 89 additions and 27 deletions

View File

@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.214 2006/07/14 14:52:20 momjian Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.215 2006/07/26 00:34:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2863,7 +2863,7 @@ make_setop(SetOpCmd cmd, Plan *lefttree,
*/
Limit *
make_limit(Plan *lefttree, Node *limitOffset, Node *limitCount,
int offset_est, int count_est)
int64 offset_est, int64 count_est)
{
Limit *node = makeNode(Limit);
Plan *plan = &node->plan;

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.203 2006/07/14 14:52:20 momjian Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.204 2006/07/26 00:34:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -59,7 +59,7 @@ static Plan *inheritance_planner(PlannerInfo *root);
static Plan *grouping_planner(PlannerInfo *root, double tuple_fraction);
static double preprocess_limit(PlannerInfo *root,
double tuple_fraction,
int *offset_est, int *count_est);
int64 *offset_est, int64 *count_est);
static bool choose_hashed_grouping(PlannerInfo *root, double tuple_fraction,
Path *cheapest_path, Path *sorted_path,
double dNumGroups, AggClauseCounts *agg_counts);
@@ -631,8 +631,8 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
{
Query *parse = root->parse;
List *tlist = parse->targetList;
int offset_est = 0;
int count_est = 0;
int64 offset_est = 0;
int64 count_est = 0;
Plan *result_plan;
List *current_pathkeys;
List *sort_pathkeys;
@@ -1080,7 +1080,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
*/
static double
preprocess_limit(PlannerInfo *root, double tuple_fraction,
int *offset_est, int *count_est)
int64 *offset_est, int64 *count_est)
{
Query *parse = root->parse;
Node *est;
@@ -1105,7 +1105,7 @@ preprocess_limit(PlannerInfo *root, double tuple_fraction,
}
else
{
*count_est = DatumGetInt32(((Const *) est)->constvalue);
*count_est = DatumGetInt64(((Const *) est)->constvalue);
if (*count_est <= 0)
*count_est = 1; /* force to at least 1 */
}
@@ -1128,7 +1128,8 @@ preprocess_limit(PlannerInfo *root, double tuple_fraction,
}
else
{
*offset_est = DatumGetInt32(((Const *) est)->constvalue);
*offset_est = DatumGetInt64(((Const *) est)->constvalue);
if (*offset_est < 0)
*offset_est = 0; /* less than 0 is same as 0 */
}