mirror of
https://github.com/postgres/postgres.git
synced 2025-10-16 17:07:43 +03:00
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.
This commit is contained in:
@@ -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 */
|
||||
|
Reference in New Issue
Block a user