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/readfuncs.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/readfuncs.c')
-rw-r--r-- | src/backend/nodes/readfuncs.c | 39 |
1 files changed, 3 insertions, 36 deletions
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); @@ -625,33 +621,6 @@ _readAgg() } /* ---------------- - * _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 * * Hash is a subclass of Noname @@ -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) |