diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-11-23 00:03:22 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-11-23 00:03:22 -0500 |
commit | 74c1723fc8dca2d70576ef2f0a66f4a7c99c173a (patch) | |
tree | a55cb1107a595453641f67d38774550969ed479e /src/backend | |
parent | df73584431e7edb1dd76578777bd0fcc17b916a1 (diff) | |
download | postgresql-74c1723fc8dca2d70576ef2f0a66f4a7c99c173a.tar.gz postgresql-74c1723fc8dca2d70576ef2f0a66f4a7c99c173a.zip |
Remove user-selectable ANALYZE option for range types.
It's not clear that a per-datatype typanalyze function would be any more
useful than a generic typanalyze for ranges. What *is* clear is that
letting unprivileged users select typanalyze functions is a crash risk or
worse. So remove the option from CREATE TYPE AS RANGE, and instead put in
a generic typanalyze function for ranges. The generic function does
nothing as yet, but hopefully we'll improve that before 9.2 release.
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/commands/typecmds.c | 18 | ||||
-rw-r--r-- | src/backend/utils/adt/rangetypes.c | 17 |
2 files changed, 18 insertions, 17 deletions
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c index 1516a2aba4f..ee75600a12c 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -1225,12 +1225,10 @@ DefineRange(CreateRangeStmt *stmt) List *rangeCollationName = NIL; List *rangeCanonicalName = NIL; List *rangeSubtypeDiffName = NIL; - List *rangeAnalyzeName = NIL; Oid rangeSubOpclass; Oid rangeCollation; regproc rangeCanonical; regproc rangeSubtypeDiff; - regproc rangeAnalyze; int16 subtyplen; bool subtypbyval; char subtypalign; @@ -1326,14 +1324,6 @@ DefineRange(CreateRangeStmt *stmt) errmsg("conflicting or redundant options"))); rangeSubtypeDiffName = defGetQualifiedName(defel); } - else if (pg_strcasecmp(defel->defname, "analyze") == 0) - { - if (rangeAnalyzeName != NIL) - ereport(ERROR, - (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("conflicting or redundant options"))); - rangeAnalyzeName = defGetQualifiedName(defel); - } else ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), @@ -1386,12 +1376,6 @@ DefineRange(CreateRangeStmt *stmt) else rangeSubtypeDiff = InvalidOid; - if (rangeAnalyzeName != NIL) - rangeAnalyze = findTypeAnalyzeFunction(rangeAnalyzeName, - typoid); - else - rangeAnalyze = InvalidOid; - get_typlenbyvalalign(rangeSubtype, &subtyplen, &subtypbyval, &subtypalign); @@ -1420,7 +1404,7 @@ DefineRange(CreateRangeStmt *stmt) F_RANGE_SEND, /* send procedure */ InvalidOid, /* typmodin procedure - none */ InvalidOid, /* typmodout procedure - none */ - rangeAnalyze, /* analyze procedure */ + F_RANGE_TYPANALYZE, /* analyze procedure */ InvalidOid, /* element type ID - none */ false, /* this is not an array type */ rangeArrayOid, /* array type we are about to create */ diff --git a/src/backend/utils/adt/rangetypes.c b/src/backend/utils/adt/rangetypes.c index 3326cb17c89..4b27d4317fb 100644 --- a/src/backend/utils/adt/rangetypes.c +++ b/src/backend/utils/adt/rangetypes.c @@ -1135,6 +1135,23 @@ hash_range(PG_FUNCTION_ARGS) PG_RETURN_INT32(result); } +/* ANALYZE support */ + +/* typanalyze function for range datatypes */ +Datum +range_typanalyze(PG_FUNCTION_ARGS) +{ + /* + * For the moment, just punt and don't analyze range columns. If we + * get close to release without having a better answer, we could + * consider letting std_typanalyze do what it can ... but those stats + * are probably next door to useless for most activity with range + * columns, so it's not clear it's worth gathering them. + */ + PG_RETURN_BOOL(false); +} + + /* *---------------------------------------------------------- * CANONICAL FUNCTIONS |