I have used this command in the shell to import a kmlKML file into a PostgreSQL database and it has worked perfectly for me. I share my solution. I hope it works for you.
ogr2ogr --config PG_USE_COPY YES -f PGDump /vsistdout/ filename.kml | psql db_name db_user