From dd979f66be20fc54aad06da743f788fbc505bbe1 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 27 Jan 2000 18:11:50 +0000 Subject: 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... --- src/backend/nodes/readfuncs.c | 39 +++------------------------------------ 1 file changed, 3 insertions(+), 36 deletions(-) (limited to 'src/backend/nodes/readfuncs.c') diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c index cf63506a05f..9dccbf50170 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.80 2000/01/26 05:56:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.81 2000/01/27 18:11:28 tgl Exp $ * * NOTES * Most of the read functions for plan nodes are tested. (In fact, they @@ -111,12 +111,8 @@ _readQuery() token = lsptok(NULL, &length); /* get unionall */ local_node->unionall = (token[0] == 't') ? true : false; - token = lsptok(NULL, &length); /* skip :uniqueFlag */ - token = lsptok(NULL, &length); /* get uniqueFlag */ - if (length == 0) - local_node->uniqueFlag = NULL; - else - local_node->uniqueFlag = debackslash(token, length); + token = lsptok(NULL, &length); /* skip :distinctClause */ + local_node->distinctClause = nodeRead(true); token = lsptok(NULL, &length); /* skip :sortClause */ local_node->sortClause = nodeRead(true); @@ -624,33 +620,6 @@ _readAgg() return local_node; } -/* ---------------- - * _readUnique - * - * For some reason, unique is a subclass of Noname. - */ -static Unique * -_readUnique() -{ - Unique *local_node; - char *token; - int length; - - local_node = makeNode(Unique); - - _getPlan((Plan *) local_node); - - token = lsptok(NULL, &length); /* eat :nonameid */ - token = lsptok(NULL, &length); /* get :nonameid */ - local_node->nonameid = atol(token); - - token = lsptok(NULL, &length); /* eat :keycount */ - token = lsptok(NULL, &length); /* get :keycount */ - local_node->keycount = atoi(token); - - return local_node; -} - /* ---------------- * _readHash * @@ -1847,8 +1816,6 @@ parsePlanString(void) return_value = _readSubLink(); else if (length == 3 && strncmp(token, "AGG", length) == 0) return_value = _readAgg(); - else if (length == 6 && strncmp(token, "UNIQUE", length) == 0) - return_value = _readUnique(); else if (length == 4 && strncmp(token, "HASH", length) == 0) return_value = _readHash(); else if (length == 6 && strncmp(token, "RESDOM", length) == 0) -- cgit v1.2.3