PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ postgis_typmod_type()

Datum postgis_typmod_type ( PG_FUNCTION_ARGS  )

Definition at line 406 of file gserialized_typmod.c.

407{
408 int32 typmod = PG_GETARG_INT32(0);
409 int32 type = TYPMOD_GET_TYPE(typmod);
410 char *s = (char*)palloc(64);
411 char *ptr = s;
412 text *stext;
413
414 /* Has type? */
415 if ( typmod < 0 || type == 0 )
416 ptr += sprintf(ptr, "Geometry");
417 else
418 ptr += sprintf(ptr, "%s", lwtype_name(type));
419
420 /* Has Z? */
421 if ( typmod >= 0 && TYPMOD_GET_Z(typmod) )
422 ptr += sprintf(ptr, "%s", "Z");
423
424 /* Has M? */
425 if ( typmod >= 0 && TYPMOD_GET_M(typmod) )
426 ptr += sprintf(ptr, "%s", "M");
427
428 stext = cstring_to_text(s);
429 pfree(s);
430 PG_RETURN_TEXT_P(stext);
431}
char * s
Definition cu_in_wkt.c:23
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition lwutil.c:216
#define TYPMOD_GET_M(typmod)
Definition liblwgeom.h:198
#define TYPMOD_GET_TYPE(typmod)
Definition liblwgeom.h:194
#define TYPMOD_GET_Z(typmod)
Definition liblwgeom.h:196
unsigned int int32
Definition shpopen.c:54

References lwtype_name(), s, TYPMOD_GET_M, TYPMOD_GET_TYPE, and TYPMOD_GET_Z.

Here is the call graph for this function: