211{
213 Datum *elem_values;
214 int n = 0;
215 int i = 0;
216
217 if (ARR_ELEMTYPE(arr) != CSTRINGOID)
218 ereport(ERROR,
219 (errcode(ERRCODE_ARRAY_ELEMENT_ERROR),
220 errmsg("typmod array must be type cstring[]")));
221
222 if (ARR_NDIM(arr) != 1)
223 ereport(ERROR,
224 (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
225 errmsg("typmod array must be one-dimensional")));
226
227 if (ARR_HASNULL(arr))
228 ereport(ERROR,
229 (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
230 errmsg("typmod array must not contain nulls")));
231
232 deconstruct_array(arr,
233 CSTRINGOID, -2, false, 'c',
234 &elem_values, NULL, &n);
235
236
237 if (is_geography)
239 else
241
242 for (i = 0; i < n; i++)
243 {
244 if ( i == 0 )
245 {
246 char *
s = DatumGetCString(elem_values[i]);
248 int z = 0;
249 int m = 0;
250
252 {
253 ereport(ERROR,
254 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
255 errmsg(
"Invalid geometry type modifier: %s",
s)));
256 }
257 else
258 {
260 if ( z )
262 if ( m )
264 }
265 }
266 if ( i == 1 )
267 {
268 int32_t srid = pg_atoi(DatumGetCString(elem_values[i]),
sizeof(
int32),
'\0');
270 POSTGIS_DEBUGF(3, "srid: %d", srid);
272 {
274 }
275 }
276 }
277
278 pfree(elem_values);
279
280 return typmod;
281}
#define TYPMOD_SET_SRID(typmod, srid)
int geometry_type_from_string(const char *str, uint8_t *type, int *z, int *m)
Utility function to get type number from string.
#define TYPMOD_SET_TYPE(typmod, type)
#define TYPMOD_SET_M(typmod)
#define SRID_UNKNOWN
Unknown SRID value.
#define TYPMOD_SET_Z(typmod)
int32_t clamp_srid(int32_t srid)
Return a valid SRID from an arbitrary integer Raises a notice if what comes out is different from wha...