1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-03 15:22:11 +03:00

Support range data types.

Selectivity estimation functions are missing for some range type operators,
which is a TODO.

Jeff Davis
This commit is contained in:
Heikki Linnakangas
2011-11-03 13:16:28 +02:00
parent 4334289186
commit 4429f6a9e3
58 changed files with 6718 additions and 103 deletions

View File

@@ -490,6 +490,8 @@ do_compile(FunctionCallInfo fcinfo,
{
if (rettypeid == ANYARRAYOID)
rettypeid = INT4ARRAYOID;
else if (rettypeid == ANYRANGEOID)
rettypeid = INT4RANGEOID;
else /* ANYELEMENT or ANYNONARRAY */
rettypeid = INT4OID;
/* XXX what could we use for ANYENUM? */
@@ -2119,6 +2121,7 @@ build_datatype(HeapTuple typeTup, int32 typmod, Oid collation)
case TYPTYPE_BASE:
case TYPTYPE_DOMAIN:
case TYPTYPE_ENUM:
case TYPTYPE_RANGE:
typ->ttype = PLPGSQL_TTYPE_SCALAR;
break;
case TYPTYPE_COMPOSITE:
@@ -2373,8 +2376,8 @@ compute_function_hashkey(FunctionCallInfo fcinfo,
/*
* This is the same as the standard resolve_polymorphic_argtypes() function,
* but with a special case for validation: assume that polymorphic arguments
* are integer or integer-array. Also, we go ahead and report the error
* if we can't resolve the types.
* are integer, integer-range or integer-array. Also, we go ahead and report
* the error if we can't resolve the types.
*/
static void
plpgsql_resolve_polymorphic_argtypes(int numargs,
@@ -2407,6 +2410,9 @@ plpgsql_resolve_polymorphic_argtypes(int numargs,
case ANYENUMOID: /* XXX dubious */
argtypes[i] = INT4OID;
break;
case ANYRANGEOID:
argtypes[i] = INT4RANGEOID;
break;
case ANYARRAYOID:
argtypes[i] = INT4ARRAYOID;
break;