PostGIS  3.0.0dev-r@@SVN_REVISION@@

◆ postgis_typmod_type()

Datum postgis_typmod_type ( PG_FUNCTION_ARGS  )

Definition at line 359 of file gserialized_typmod.c.

References lwtype_name(), PG_FUNCTION_INFO_V1(), postgis_typmod_dims(), s, ovdump::type, TYPMOD_GET_M, TYPMOD_GET_TYPE, and TYPMOD_GET_Z.

Referenced by geometry_enforce_typmod().

360 {
361  int32 typmod = PG_GETARG_INT32(0);
362  int32 type = TYPMOD_GET_TYPE(typmod);
363  char *s = (char*)palloc(64);
364  char *ptr = s;
365  text *stext;
366 
367  /* Has type? */
368  if ( typmod < 0 || type == 0 )
369  ptr += sprintf(ptr, "Geometry");
370  else
371  ptr += sprintf(ptr, "%s", lwtype_name(type));
372 
373  /* Has Z? */
374  if ( typmod >= 0 && TYPMOD_GET_Z(typmod) )
375  ptr += sprintf(ptr, "%s", "Z");
376 
377  /* Has M? */
378  if ( typmod >= 0 && TYPMOD_GET_M(typmod) )
379  ptr += sprintf(ptr, "%s", "M");
380 
381  stext = cstring_to_text(s);
382  pfree(s);
383  PG_RETURN_TEXT_P(stext);
384 }
#define TYPMOD_GET_TYPE(typmod)
Definition: liblwgeom.h:166
unsigned int int32
Definition: shpopen.c:273
#define TYPMOD_GET_M(typmod)
Definition: liblwgeom.h:170
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:216
char * s
Definition: cu_in_wkt.c:23
type
Definition: ovdump.py:41
#define TYPMOD_GET_Z(typmod)
Definition: liblwgeom.h:168
Here is the call graph for this function:
Here is the caller graph for this function: