Index: src/backend/utils/adt/regexp.c =================================================================== RCS file: /home/jeremyd/local/postgres/cvsuproot/pgsql/src/backend/utils/adt/regexp.c,v retrieving revision 1.70 diff -c -r1.70 regexp.c *** src/backend/utils/adt/regexp.c 20 Mar 2007 05:44:59 -0000 1.70 --- src/backend/utils/adt/regexp.c 22 Mar 2007 05:17:15 -0000 *************** *** 30,35 **** --- 30,36 ---- #include "postgres.h" #include "access/heapam.h" + #include "catalog/pg_type.h" #include "funcapi.h" #include "regex/regex.h" #include "utils/builtins.h" *************** *** 95,106 **** size_t offset; re_comp_flags flags; - - /* text type info */ - Oid param_type; - int16 typlen; - bool typbyval; - char typalign; } regexp_matches_ctx; typedef struct regexp_split_ctx --- 96,101 ---- *************** *** 835,845 **** matchctx->pmatch = palloc(sizeof(regmatch_t) * (matchctx->cpattern->re_nsub + 1)); matchctx->offset = 0; - /* get text type oid, too lazy to do it some other way */ - matchctx->param_type = get_fn_expr_argtype(fcinfo->flinfo, 0); - get_typlenbyvalalign(matchctx->param_type, &matchctx->typlen, - &matchctx->typbyval, &matchctx->typalign); - matchctx->wide_str = palloc(sizeof(pg_wchar) * (matchctx->orig_len + 1)); matchctx->wide_len = pg_mb2wchar_with_len(VARDATA(matchctx->orig_str), matchctx->wide_str, matchctx->orig_len); --- 830,835 ---- *************** *** 915,923 **** dims[0] = 1; } return construct_md_array(elems, nulls, ndims, dims, lbs, ! matchctx->param_type, matchctx->typlen, ! matchctx->typbyval, matchctx->typalign); } Datum --- 905,913 ---- dims[0] = 1; } + /* XXX: this hardcodes assumptions about the text type */ return construct_md_array(elems, nulls, ndims, dims, lbs, ! TEXTOID, -1, false, 'i'); } Datum *************** *** 976,991 **** { ArrayBuildState *astate = NULL; regexp_split_ctx *splitctx; - Oid param_type; int nitems; splitctx = setup_regexp_split(PG_GETARG_TEXT_P(0), PG_GETARG_TEXT_P(1), PG_GETARG_TEXT_P_IF_EXISTS(2)); - /* get text type oid, too lazy to do it some other way */ - param_type = get_fn_expr_argtype(fcinfo->flinfo, 0); - for (nitems = 0; splitctx->offset < splitctx->wide_len; nitems++) { if (nitems > splitctx->wide_len) --- 966,977 ---- *************** *** 995,1001 **** astate = accumArrayResult(astate, get_next_split(splitctx), false, ! param_type, CurrentMemoryContext); } --- 981,987 ---- astate = accumArrayResult(astate, get_next_split(splitctx), false, ! TEXTOID, CurrentMemoryContext); }