ST_Buffer — (T) For geometry: Returns a geometry that represents all points whose distance from this Geometry is less than or equal to distance. Calculations are in the Spatial Reference System of this Geometry. For geography: Uses a planar transform wrapper. Introduced in 1.5 support for different end cap and mitre settings to control shape. buffer_style options: quad_segs=#,endcap=roundflatsquare,join=roundmitrebevel,mitre_limit=#.#
geometry ST_Buffer(
geometry g1, float radius_of_buffer)
;
geometry ST_Buffer(
geometry g1, float radius_of_buffer, integer num_seg_quarter_circle)
;
geometry ST_Buffer(
geometry g1, float radius_of_buffer, text buffer_style_parameters)
;
geography ST_Buffer(
geography g1, float radius_of_buffer_in_meters)
;
Returns a geometry/geography that represents all points whose distance from this Geometry/geography is less than or equal to distance.
Geometry: Calculations are in the Spatial Reference System of the geometry. Introduced in 1.5 support for different end cap and mitre settings to control shape.
Negative radii: For polygons, a negative radius can be used, which will shrink the polygon rather than expanding it. 
Geography: For geography this is really a thin wrapper around the geometry implementation. It first determines the best SRID that fits the bounding box of the geography object (favoring UTM, Lambert Azimuthal Equal Area (LAEA) north/south pole, and falling back on mercator in worst case scenario) and then buffers in that planar spatial ref and retransforms back to WGS84 geography. 
For geography this may not behave as expected if object is sufficiently large that it falls between two UTM zones or crosses the dateline
Availability: 1.5  ST_Buffer was enhanced to support different endcaps and join types. These are useful for example to convert road linestrings into polygon roads with flat or square edges instead of rounded edges. Thin wrapper for geography was added.  requires GEOS >= 3.2 to take advantage of advanced geometry functionality.
The optional third parameter (currently only applies to geometry) can either specify number of segments used to approximate a quarter circle (integer case, defaults to 8) or a list of blankseparated key=value pairs (string case) to tweak operations as follows:
Units of radius are measured in units of the spatial reference system.
The inputs can be POINTS, MULTIPOINTS, LINESTRINGS, MULTILINESTRINGS, POLYGONS, MULTIPOLYGONS, and GeometryCollections.
This function ignores the third dimension (z) and will always give a 2d buffer even when presented with a 3dgeometry. 
Performed by the GEOS module.
This method implements the OpenGIS Simple Features Implementation Specification for SQL 1.1. s2.1.1.3
This method implements the SQL/MM specification. SQLMM 3: 5.1.17
People often make the mistake of using this function to try to do radius searches. Creating a buffer to to a radius search is slow and pointless. Use ST_DWithin instead. 
SELECT ST_Buffer( ST_GeomFromText('POINT(100 90)'), 50, 'quad_segs=8');

SELECT ST_Buffer( ST_GeomFromText('POINT(100 90)'), 50, 'quad_segs=2');
 
SELECT ST_Buffer( ST_GeomFromText( 'LINESTRING(50 50,150 150,150 50)' ), 10, 'endcap=round join=round');

SELECT ST_Buffer( ST_GeomFromText( 'LINESTRING(50 50,150 150,150 50)' ), 10, 'endcap=square join=round');

SELECT ST_Buffer( ST_GeomFromText( 'LINESTRING(50 50,150 150,150 50)' ), 10, 'endcap=flat join=round');

SELECT ST_Buffer( ST_GeomFromText( 'LINESTRING(50 50,150 150,150 50)' ), 10, 'join=bevel');

SELECT ST_Buffer( ST_GeomFromText( 'LINESTRING(50 50,150 150,150 50)' ), 10, 'join=mitre mitre_limit=5.0');

SELECT ST_Buffer( ST_GeomFromText( 'LINESTRING(50 50,150 150,150 50)' ), 10, 'join=mitre mitre_limit=1.0');

A buffered point approximates a circle  A buffered point forcing approximation of (see diagram)  2 points per circle is poly with 8 sides (see diagram) SELECT ST_NPoints(ST_Buffer(ST_GeomFromText('POINT(100 90)'), 50)) As promisingcircle_pcount, ST_NPoints(ST_Buffer(ST_GeomFromText('POINT(100 90)'), 50, 2)) As lamecircle_pcount; promisingcircle_pcount  lamecircle_pcount + 33  9 A lighter but lamer circle  only 2 points per quarter circle is an octagon Below is a 100 meter octagon  Note coordinates are in NAD 83 long lat which we transform to Mass state plane meter and then buffer to get measurements in meters; SELECT ST_AsText(ST_Buffer( ST_Transform( ST_SetSRID(ST_MakePoint(71.063526, 42.35785),4269), 26986) ,100,2)) As octagon;  POLYGON((236057.59057465 900908.759918696,236028.301252769 900838.049240578,235 957.59057465 900808.759918696,235886.879896532 900838.049240578,235857.59057465 900908.759918696,235886.879896532 900979.470596815,235957.59057465 901008.759918 696,236028.301252769 900979.470596815,236057.59057465 900908.759918696))