1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

Re-implement LIMIT/OFFSET as a plan node type, instead of a hack in

ExecutorRun.  This allows LIMIT to work in a view.  Also, LIMIT in a
cursor declaration will behave in a reasonable fashion, whereas before
it was overridden by the FETCH count.
This commit is contained in:
Tom Lane
2000-10-26 21:38:24 +00:00
parent c9476bafdb
commit 2f35b4efdb
26 changed files with 572 additions and 232 deletions

View File

@ -3,7 +3,7 @@
* back to source text
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.66 2000/10/05 21:52:08 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.67 2000/10/26 21:37:45 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@ -886,8 +886,8 @@ get_select_query_def(Query *query, deparse_context *context)
/* ----------
* If the Query node has a setOperations tree, then it's the top
* level of a UNION/INTERSECT/EXCEPT query; only the ORDER BY field
* is interesting in the top query itself.
* level of a UNION/INTERSECT/EXCEPT query; only the ORDER BY and
* LIMIT fields are interesting in the top query itself.
* ----------
*/
if (query->setOperations)
@ -931,6 +931,18 @@ get_select_query_def(Query *query, deparse_context *context)
sep = ", ";
}
}
/* Add the LIMIT clause if given */
if (query->limitOffset != NULL)
{
appendStringInfo(buf, " OFFSET ");
get_rule_expr(query->limitOffset, context);
}
if (query->limitCount != NULL)
{
appendStringInfo(buf, " LIMIT ");
get_rule_expr(query->limitCount, context);
}
}
static void