diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-10-26 21:38:24 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-10-26 21:38:24 +0000 |
commit | 2f35b4efdbec6c161ca9bd491d6345134910c425 (patch) | |
tree | 2424351bcc12a8ddf2b716b28f53d2c37c79e507 /src/backend/nodes/copyfuncs.c | |
parent | c9476bafdb1b97d0d21d92788f93298962145479 (diff) | |
download | postgresql-2f35b4efdbec6c161ca9bd491d6345134910c425.tar.gz postgresql-2f35b4efdbec6c161ca9bd491d6345134910c425.zip |
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.
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r-- | src/backend/nodes/copyfuncs.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 3d740533ff0..e78de345d9c 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -15,7 +15,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.126 2000/10/18 16:16:04 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.127 2000/10/26 21:35:47 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -593,6 +593,31 @@ _copySetOp(SetOp *from) } /* ---------------- + * _copyLimit + * ---------------- + */ +static Limit * +_copyLimit(Limit *from) +{ + Limit *newnode = makeNode(Limit); + + /* ---------------- + * copy node superclass fields + * ---------------- + */ + CopyPlanFields((Plan *) from, (Plan *) newnode); + + /* ---------------- + * copy remainder of node + * ---------------- + */ + Node_Copy(from, newnode, limitOffset); + Node_Copy(from, newnode, limitCount); + + return newnode; +} + +/* ---------------- * _copyHash * ---------------- */ @@ -2567,6 +2592,9 @@ copyObject(void *from) case T_SetOp: retval = _copySetOp(from); break; + case T_Limit: + retval = _copyLimit(from); + break; case T_Hash: retval = _copyHash(from); break; |