summaryrefslogtreecommitdiff
path: root/src/backend/nodes/copyfuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-01-09 02:14:16 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-01-09 02:14:16 +0000
commit443175822942ef1f15cd047cda58990a089ef180 (patch)
treea5e4272719d3323d9aa17312d0d867804b652f10 /src/backend/nodes/copyfuncs.c
parent3a32ba2f3f54378e3e06366a5ff06e339984f065 (diff)
Support ORDER BY ... NULLS FIRST/LAST, and add ASC/DESC/NULLS FIRST/NULLS LAST
per-column options for btree indexes. The planner's support for this is still pretty rudimentary; it does not yet know how to plan mergejoins with nondefault ordering options. The documentation is pretty rudimentary, too. I'll work on improving that stuff later. Note incompatible change from prior behavior: ORDER BY ... USING will now be rejected if the operator is not a less-than or greater-than member of some btree opclass. This prevents less-than-sane behavior if an operator that doesn't actually define a proper sort ordering is selected.
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r--src/backend/nodes/copyfuncs.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index e1117179ef2..08817e54a91 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
- * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.359 2007/01/05 22:19:29 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.360 2007/01/09 02:14:11 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -510,6 +510,7 @@ _copySort(Sort *from)
COPY_SCALAR_FIELD(numCols);
COPY_POINTER_FIELD(sortColIdx, from->numCols * sizeof(AttrNumber));
COPY_POINTER_FIELD(sortOperators, from->numCols * sizeof(Oid));
+ COPY_POINTER_FIELD(nullsFirst, from->numCols * sizeof(bool));
return newnode;
}
@@ -1283,6 +1284,7 @@ _copyPathKeyItem(PathKeyItem *from)
COPY_NODE_FIELD(key);
COPY_SCALAR_FIELD(sortop);
+ COPY_SCALAR_FIELD(nulls_first);
return newnode;
}
@@ -1432,6 +1434,7 @@ _copySortClause(SortClause *from)
COPY_SCALAR_FIELD(tleSortGroupRef);
COPY_SCALAR_FIELD(sortop);
+ COPY_SCALAR_FIELD(nulls_first);
return newnode;
}
@@ -1443,6 +1446,7 @@ _copyGroupClause(GroupClause *from)
COPY_SCALAR_FIELD(tleSortGroupRef);
COPY_SCALAR_FIELD(sortop);
+ COPY_SCALAR_FIELD(nulls_first);
return newnode;
}
@@ -1597,7 +1601,8 @@ _copySortBy(SortBy *from)
{
SortBy *newnode = makeNode(SortBy);
- COPY_SCALAR_FIELD(sortby_kind);
+ COPY_SCALAR_FIELD(sortby_dir);
+ COPY_SCALAR_FIELD(sortby_nulls);
COPY_NODE_FIELD(useOp);
COPY_NODE_FIELD(node);
@@ -1646,6 +1651,8 @@ _copyIndexElem(IndexElem *from)
COPY_STRING_FIELD(name);
COPY_NODE_FIELD(expr);
COPY_NODE_FIELD(opclass);
+ COPY_SCALAR_FIELD(ordering);
+ COPY_SCALAR_FIELD(nulls_ordering);
return newnode;
}