ST_NDims
Name
ST_NDims — Returns coordinate dimension of the geometry as a small int. Values are: 2,3 or 4.
Synopsis
    
     integer
     
      ST_NDims
     
     (
    
    geometry
    
     g1
    
    
     )
    
    ;
   
Description
Returns the coordinate dimension of the geometry. PostGIS supports 2 - (x,y) , 3 - (x,y,z) or 2D with measure - x,y,m, and 4 - 3D with measure space x,y,z,m
   
    
   
   This function supports 3d and will not drop the z-index.