mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
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...
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user