summaryrefslogtreecommitdiff
path: root/src/backend/commands/analyze.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-01-09 02:14:16 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-01-09 02:14:16 +0000
commit443175822942ef1f15cd047cda58990a089ef180 (patch)
treea5e4272719d3323d9aa17312d0d867804b652f10 /src/backend/commands/analyze.c
parent3a32ba2f3f54378e3e06366a5ff06e339984f065 (diff)
Support ORDER BY ... NULLS FIRST/LAST, and add ASC/DESC/NULLS FIRST/NULLS LAST
per-column options for btree indexes. The planner's support for this is still pretty rudimentary; it does not yet know how to plan mergejoins with nondefault ordering options. The documentation is pretty rudimentary, too. I'll work on improving that stuff later. Note incompatible change from prior behavior: ORDER BY ... USING will now be rejected if the operator is not a less-than or greater-than member of some btree opclass. This prevents less-than-sane behavior if an operator that doesn't actually define a proper sort ordering is selected.
Diffstat (limited to 'src/backend/commands/analyze.c')
-rw-r--r--src/backend/commands/analyze.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index 102be0d96fe..c568f04284c 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.102 2007/01/05 22:19:25 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.103 2007/01/09 02:14:11 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1297,7 +1297,7 @@ typedef struct
typedef struct
{
FmgrInfo *cmpFn;
- SortFunctionKind cmpFnKind;
+ int cmpFlags;
int *tupnoLink;
} CompareScalarsContext;
@@ -1747,8 +1747,8 @@ compute_scalar_stats(VacAttrStatsP stats,
bool is_varwidth = (!stats->attr->attbyval &&
stats->attr->attlen < 0);
double corr_xysum;
- RegProcedure cmpFn;
- SortFunctionKind cmpFnKind;
+ Oid cmpFn;
+ int cmpFlags;
FmgrInfo f_cmpfn;
ScalarItem *values;
int values_cnt = 0;
@@ -1763,7 +1763,7 @@ compute_scalar_stats(VacAttrStatsP stats,
tupnoLink = (int *) palloc(samplerows * sizeof(int));
track = (ScalarMCVItem *) palloc(num_mcv * sizeof(ScalarMCVItem));
- SelectSortFunction(mystats->ltopr, &cmpFn, &cmpFnKind);
+ SelectSortFunction(mystats->ltopr, false, &cmpFn, &cmpFlags);
fmgr_info(cmpFn, &f_cmpfn);
/* Initial scan to find sortable values */
@@ -1833,7 +1833,7 @@ compute_scalar_stats(VacAttrStatsP stats,
/* Sort the collected values */
cxt.cmpFn = &f_cmpfn;
- cxt.cmpFnKind = cmpFnKind;
+ cxt.cmpFlags = cmpFlags;
cxt.tupnoLink = tupnoLink;
qsort_arg((void *) values, values_cnt, sizeof(ScalarItem),
compare_scalars, (void *) &cxt);
@@ -2203,7 +2203,7 @@ compare_scalars(const void *a, const void *b, void *arg)
CompareScalarsContext *cxt = (CompareScalarsContext *) arg;
int32 compare;
- compare = ApplySortFunction(cxt->cmpFn, cxt->cmpFnKind,
+ compare = ApplySortFunction(cxt->cmpFn, cxt->cmpFlags,
da, false, db, false);
if (compare != 0)
return compare;