1954 {
1955 Oid etype;
1956 Datum *e;
1957 bool *nulls;
1958 int16 typlen;
1959 bool typbyval;
1960 char typalign;
1961 int n = 0;
1962
1963 HeapTupleHeader tup;
1964 bool isnull;
1965 Datum tupv;
1966
1967 int i;
1969 char *utypename = NULL;
1971
1972 etype = ARR_ELEMTYPE(array);
1973 get_typlenbyvalalign(etype, &typlen, &typbyval, &typalign);
1974
1975 deconstruct_array(
1976 array,
1977 etype,
1978 typlen, typbyval, typalign,
1979 &e, &nulls, &n
1980 );
1981
1982 if (!n) {
1983 elog(ERROR, "rtpg_union_unionarg_process: Invalid argument for unionarg");
1984 return 0;
1985 }
1986
1987
1991 elog(ERROR, "rtpg_union_unionarg_process: Could not allocate memory for band information");
1992 return 0;
1993 }
1994
1995
1996 for (i = 0; i < n; i++) {
1997 if (nulls[i]) {
1999 continue;
2000 }
2001
2003
2004
2005 tup = (HeapTupleHeader) DatumGetPointer(e[i]);
2006 if (NULL == tup) {
2007 elog(ERROR, "rtpg_union_unionarg_process: Invalid argument for unionarg");
2008 return 0;
2009 }
2010
2011
2012 tupv = GetAttributeByName(tup, "nband", &isnull);
2013 if (isnull) {
2015 elog(NOTICE, "First argument (nband) of unionarg is NULL. Assuming nband = %d", nband);
2016 }
2017 else
2018 nband = DatumGetInt32(tupv);
2019
2020 if (nband < 1) {
2021 elog(ERROR, "rtpg_union_unionarg_process: Band number must be greater than zero (1-based)");
2022 return 0;
2023 }
2024
2025
2026 tupv = GetAttributeByName(tup, "uniontype", &isnull);
2027 if (isnull) {
2028 elog(NOTICE, "Second argument (uniontype) of unionarg is NULL. Assuming uniontype = LAST");
2030 }
2031 else {
2034 }
2035
2039
2040 if (
2043 ) {
2045 }
2046 else
2048 }
2049
2053 elog(ERROR, "rtpg_union_unionarg_process: Could not reallocate memory for band information");
2054 return 0;
2055 }
2056 }
2057
2058 return 1;
2059}
char * text_to_cstring(const text *textptr)
char * rtpg_strtoupper(char *str)
static rtpg_union_type rtpg_uniontype_index_from_name(const char *cutype)
#define POSTGIS_RT_DEBUGF(level, msg,...)
rtpg_union_band_arg bandarg
rtpg_union_type uniontype