How to import KML file, with custom data, to Postgres/PostGIS database?
you can use ST_GeomFromKML as this page.
SELECT ST_GeomFromKML('
<LineString>
<coordinates>-71.1663,42.2614
-71.1667,42.2616</coordinates>
</LineString>');
or you can use ogr2ogr as following to process entire KML files;
ogr2ogr -f "PostgreSQL" PG:"host=yourhost user=youruser dbname=yourdb
password=yourpass" inputfilename.kml
i hope it helps you...