mirror of
https://github.com/postgres/postgres.git
synced 2025-05-19 00:04:06 -04:00
to represent DISTINCT or DISTINCT ON. This gets rid of a longstanding annoyance that a view or rule using SELECT DISTINCT will be dumped out with an overspecified ORDER BY list, and is one small step along the way to decoupling DISTINCT and ORDER BY enough so that hash-based implementation of DISTINCT will be possible. In passing, improve transformDistinctClause so that it doesn't reject duplicate DISTINCT ON items, as was reported by Steve Midgley a couple weeks ago.
44 lines
1.7 KiB
C
44 lines
1.7 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* parse_clause.h
|
|
* handle clauses in parser
|
|
*
|
|
*
|
|
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* $PostgreSQL: pgsql/src/include/parser/parse_clause.h,v 1.50 2008/07/31 22:47:56 tgl Exp $
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef PARSE_CLAUSE_H
|
|
#define PARSE_CLAUSE_H
|
|
|
|
#include "parser/parse_node.h"
|
|
|
|
extern void transformFromClause(ParseState *pstate, List *frmList);
|
|
extern int setTargetTable(ParseState *pstate, RangeVar *relation,
|
|
bool inh, bool alsoSource, AclMode requiredPerms);
|
|
extern bool interpretInhOption(InhOption inhOpt);
|
|
extern bool interpretOidsOption(List *defList);
|
|
|
|
extern Node *transformWhereClause(ParseState *pstate, Node *clause,
|
|
const char *constructName);
|
|
extern Node *transformLimitClause(ParseState *pstate, Node *clause,
|
|
const char *constructName);
|
|
extern List *transformGroupClause(ParseState *pstate, List *grouplist,
|
|
List **targetlist, List *sortClause);
|
|
extern List *transformSortClause(ParseState *pstate, List *orderlist,
|
|
List **targetlist, bool resolveUnknown);
|
|
extern List *transformDistinctClause(ParseState *pstate, List *distinctlist,
|
|
List **targetlist, List *sortClause);
|
|
|
|
extern List *addTargetToSortList(ParseState *pstate, TargetEntry *tle,
|
|
List *sortlist, List *targetlist,
|
|
SortByDir sortby_dir, SortByNulls sortby_nulls,
|
|
List *sortby_opname, bool resolveUnknown);
|
|
extern Index assignSortGroupRef(TargetEntry *tle, List *tlist);
|
|
extern bool targetIsInSortList(TargetEntry *tle, Oid sortop, List *sortList);
|
|
|
|
#endif /* PARSE_CLAUSE_H */
|