Amazon Redshift will no longer support the creation of new Python UDFs starting November 1, 2025. 
  If you would like to use Python UDFs, create the UDFs prior to that date. 
  Existing Python UDFs will continue to function as normal. For more information, see the
  
          blog post
        
ST_Buffer
ST_Buffer returns 2D geometry that represents all points whose distance from the input geometry projected on the xy-Cartesian plane is less than or equal to the input distance.
Syntax
ST_Buffer(geom, distance)
ST_Buffer(geom, distance, number_of_segments_per_quarter_circle)
Arguments
- geom
 - 
                     
A value of data type
GEOMETRYor an expression that evaluates to aGEOMETRYtype. - distance
 - 
                     
A value of data type
DOUBLE PRECISIONthat represents distance (or radius) of the buffer. - number_of_segments_per_quarter_circle
 - 
                     
A value of data type
INTEGER. This value determines the number of points to approximate a quarter circle around each vertex of the input geometry. Negative values default to zero. The default is 8. 
Return type
GEOMETRY
The ST_Buffer function returns two-dimensional (2D) geometry in the xy-Cartesian plane.
If geom is a GEOMETRYCOLLECTION, then an error is returned.
Examples
The following SQL returns the buffer of the input linestring.
SELECT ST_AsEwkt(ST_Buffer(ST_GeomFromText('LINESTRING(1 2,5 2,5 8)'), 2));
               st_asewkt  
POLYGON((-1 2,-0.96157056080646 2.39018064403226,-0.847759065022573 2.76536686473018,-0.662939224605089 3.11114046603921,-0.414213562373093 3.4142135623731,-0.111140466039201 3.66293922460509,0.234633135269824 3.84775906502257,0.609819355967748 3.96157056080646,1 4,3 4,3 8,3.03842943919354 8.39018064403226,3.15224093497743 8.76536686473018,3.33706077539491 9.11114046603921,3.58578643762691 9.4142135623731,3.8888595339608 9.66293922460509,4.23463313526982 9.84775906502257,4.60981935596775 9.96157056080646,5 10,5.39018064403226 9.96157056080646,5.76536686473018 9.84775906502257,6.11114046603921 9.66293922460509,6.4142135623731 9.41421356237309,6.66293922460509 9.1111404660392,6.84775906502258 8.76536686473017,6.96157056080646 8.39018064403225,7 8,7 2,6.96157056080646 1.60981935596774,6.84775906502257 1.23463313526982,6.66293922460509 0.888859533960796,6.41421356237309 0.585786437626905,6.1111404660392 0.33706077539491,5.76536686473018 0.152240934977427,5.39018064403226 0.0384294391935391,5 0,1 0,0.609819355967744 0.0384294391935391,0.234633135269821 0.152240934977427,-0.111140466039204 0.337060775394909,-0.414213562373095 0.585786437626905,-0.662939224605091 0.888859533960796,-0.847759065022574 1.23463313526982,-0.961570560806461 1.60981935596774,-1 2))
            The following SQL returns the buffer of the input point geometry which approximates a circle. Because the command doesn't specify the number of segments per quarter circle, the function uses the default value of eight segments to approximate the quarter circle.
SELECT ST_AsEwkt(ST_Buffer(ST_GeomFromText('POINT(3 4)'), 2));
               st_asewkt
POLYGON((1 4,1.03842943919354 4.39018064403226,1.15224093497743 4.76536686473018,1.33706077539491 5.11114046603921,1.58578643762691 5.4142135623731,1.8888595339608 5.66293922460509,2.23463313526982 5.84775906502257,2.60981935596775 5.96157056080646,3 6,3.39018064403226 5.96157056080646,3.76536686473019 5.84775906502257,4.11114046603921 5.66293922460509,4.4142135623731 5.41421356237309,4.66293922460509 5.1111404660392,4.84775906502258 4.76536686473017,4.96157056080646 4.39018064403225,5 4,4.96157056080646 3.60981935596774,4.84775906502257 3.23463313526982,4.66293922460509 2.8888595339608,4.41421356237309 2.58578643762691,4.1111404660392 2.33706077539491,3.76536686473018 2.15224093497743,3.39018064403226 2.03842943919354,3 2,2.60981935596774 2.03842943919354,2.23463313526982 2.15224093497743,1.8888595339608 2.33706077539491,1.58578643762691 2.58578643762691,1.33706077539491 2.8888595339608,1.15224093497743 3.23463313526982,1.03842943919354 3.60981935596774,1 4))
            The following SQL returns the buffer of the input point geometry which approximates a circle. Because the command specifies 3 as the number of segments per quarter circle, the function uses three segments to approximate the quarter circle.
SELECT ST_AsEwkt(ST_Buffer(ST_GeomFromText('POINT(3 4)'), 2, 3));
               st_asewkt
POLYGON((1 4,1.26794919243112 5,2 5.73205080756888,3 6,4 5.73205080756888,4.73205080756888 5,5 4,4.73205080756888 3,4 2.26794919243112,3 2,2 2.26794919243112,1.26794919243112 3,1 4))