diff options
| author | Tom Lane | 2004-06-06 00:41:28 +0000 |
|---|---|---|
| committer | Tom Lane | 2004-06-06 00:41:28 +0000 |
| commit | c541bb86e9ec8fed37b23df6a0df703d0bde4dfa (patch) | |
| tree | b4cff96eecc86e338274ec5d7355918efe9c149e /src/backend/parser | |
| parent | c3a153afed84e29dac664bdc6123724a9e3a906f (diff) | |
Infrastructure for I/O of composite types: arrange for the I/O routines
of a composite type to get that type's OID as their second parameter,
in place of typelem which is useless. The actual changes are mostly
centralized in getTypeInputInfo and siblings, but I had to fix a few
places that were fetching pg_type.typelem for themselves instead of
using the lsyscache.c routines. Also, I renamed all the related variables
from 'typelem' to 'typioparam' to discourage people from assuming that
they necessarily contain array element types.
Diffstat (limited to 'src/backend/parser')
| -rw-r--r-- | src/backend/parser/parse_coerce.c | 8 | ||||
| -rw-r--r-- | src/backend/parser/parse_type.c | 81 |
2 files changed, 13 insertions, 76 deletions
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c index 9ba0bdc90f9..b12d1854aa8 100644 --- a/src/backend/parser/parse_coerce.c +++ b/src/backend/parser/parse_coerce.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.117 2004/05/30 23:40:35 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.118 2004/06/06 00:41:26 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -356,14 +356,10 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *target_typeids, /* * If input is an untyped string constant, assume we can convert - * it to anything except a class type. + * it to anything. */ if (inputTypeId == UNKNOWNOID) - { - if (ISCOMPLEX(targetTypeId)) - return false; continue; - } /* * If pg_cast shows that we can coerce, accept. This test now diff --git a/src/backend/parser/parse_type.c b/src/backend/parser/parse_type.c index be4877909f7..79cc9d8bf4a 100644 --- a/src/backend/parser/parse_type.c +++ b/src/backend/parser/parse_type.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_type.c,v 1.68 2004/06/03 19:41:46 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_type.c,v 1.69 2004/06/06 00:41:26 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -323,83 +323,24 @@ typeTypeRelid(Type typ) return typtup->typrelid; } -#ifdef NOT_USED -Oid -typeTypElem(Type typ) -{ - Form_pg_type typtup; - - typtup = (Form_pg_type) GETSTRUCT(typ); - - return typtup->typelem; -} -#endif - -#ifdef NOT_USED -/* Given a type structure, return the in-conversion function of the type */ -Oid -typeInfunc(Type typ) -{ - Form_pg_type typtup; - - typtup = (Form_pg_type) GETSTRUCT(typ); - - return typtup->typinput; -} -#endif - -#ifdef NOT_USED -/* Given a type structure, return the out-conversion function of the type */ -Oid -typeOutfunc(Type typ) -{ - Form_pg_type typtup; - - typtup = (Form_pg_type) GETSTRUCT(typ); - - return typtup->typoutput; -} -#endif - -/* Given a type structure and a string, returns the internal form of - that string */ +/* + * Given a type structure and a string, returns the internal representation + * of that string + */ Datum stringTypeDatum(Type tp, char *string, int32 atttypmod) { - Oid op; - Oid typelem; + Oid typinput; + Oid typioparam; - op = ((Form_pg_type) GETSTRUCT(tp))->typinput; - typelem = ((Form_pg_type) GETSTRUCT(tp))->typelem; /* XXX - used for - * array_in */ - return OidFunctionCall3(op, + typinput = ((Form_pg_type) GETSTRUCT(tp))->typinput; + typioparam = getTypeIOParam(tp); + return OidFunctionCall3(typinput, CStringGetDatum(string), - ObjectIdGetDatum(typelem), + ObjectIdGetDatum(typioparam), Int32GetDatum(atttypmod)); } -/* Given a type id, returns the out-conversion function of the type */ -#ifdef NOT_USED -Oid -typeidOutfunc(Oid type_id) -{ - HeapTuple typeTuple; - Form_pg_type type; - Oid outfunc; - - typeTuple = SearchSysCache(TYPEOID, - ObjectIdGetDatum(type_id), - 0, 0, 0); - if (!HeapTupleIsValid(typeTuple)) - elog(ERROR, "cache lookup failed for type %u", type_id); - - type = (Form_pg_type) GETSTRUCT(typeTuple); - outfunc = type->typoutput; - ReleaseSysCache(typeTuple); - return outfunc; -} -#endif - /* given a typeid, return the type's typrelid (associated relation, if any) */ Oid typeidTypeRelid(Oid type_id) |
