diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-01-27 18:11:50 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-01-27 18:11:50 +0000 |
commit | dd979f66be20fc54aad06da743f788fbc505bbe1 (patch) | |
tree | 4d6b578e0afc7dc0198296940cd77c79c5eff66c /src/backend/nodes/copyfuncs.c | |
parent | 3f0074e403ac3a145c5e43db3348f45fe084703d (diff) | |
download | postgresql-dd979f66be20fc54aad06da743f788fbc505bbe1.tar.gz postgresql-dd979f66be20fc54aad06da743f788fbc505bbe1.zip |
Redesign DISTINCT ON as discussed in pgsql-sql 1/25/00: syntax is now
SELECT DISTINCT ON (expr [, expr ...]) targetlist ...
and there is a check to make sure that the user didn't specify an ORDER BY
that's incompatible with the DISTINCT operation.
Reimplement nodeUnique and nodeGroup to use the proper datatype-specific
equality function for each column being compared --- they used to do
bitwise comparisons or convert the data to text strings and strcmp().
(To add insult to injury, they'd look up the conversion functions once
for each tuple...) Parse/plan representation of DISTINCT is now a list
of SortClause nodes.
initdb forced by querytree change...
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r-- | src/backend/nodes/copyfuncs.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 6c8d92355a0..cb447b63717 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.102 2000/01/26 05:56:31 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.103 2000/01/27 18:11:27 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -532,11 +532,9 @@ _copyUnique(Unique *from) * copy remainder of node * ---------------- */ - if (from->uniqueAttr) - newnode->uniqueAttr = pstrdup(from->uniqueAttr); - else - newnode->uniqueAttr = NULL; - newnode->uniqueAttrNum = from->uniqueAttrNum; + newnode->numCols = from->numCols; + newnode->uniqColIdx = palloc(from->numCols * sizeof(AttrNumber)); + memcpy(newnode->uniqColIdx, from->uniqColIdx, from->numCols * sizeof(AttrNumber)); return newnode; } @@ -1427,8 +1425,7 @@ _copyQuery(Query *from) Node_Copy(from, newnode, qual); Node_Copy(from, newnode, rowMark); - if (from->uniqueFlag) - newnode->uniqueFlag = pstrdup(from->uniqueFlag); + Node_Copy(from, newnode, distinctClause); Node_Copy(from, newnode, sortClause); Node_Copy(from, newnode, groupClause); Node_Copy(from, newnode, havingQual); |