I have some point data in PostgreSQL / PostGIS. How do I export the data to a GPX file? I looked for commands similar to ST_AsGML and ST_AsKML but could not find anything to convert to GPX (like a ST_AsGPX).
Not quite in PostGIS but you should be able to extract it using ogr2ogr's GPX driver
ogr2ogr -f GPX points.gpx PG:'host=your_server user=your_username dbname=your_database'
You can also use DNRGPS to convert from PostgreSQL to GPX. Great utility.
The GPX format is a standard text tag format and so can be built as a text file manually or with code if necessary. Most spatial software (if you have access to it: QGIS, ArcGIS, Global Mapper etc) will have utilities to simplify the conversion from a file or feature class to GPX in some form. Depending on how you wish to build your GPX file (track points vs way points etc) and device you wish to load it on it might be easier to get the desired result by using a bulk export utility (like those mentioned above) and then edit the text tags of the resulting GPX file.
Sometimes a combined approach is the only way to get exactly what you need. The specification link will give you all the tag references.