Thanks for sharing!
+1 to Jeroen Coussement!btw. a "json"-option for "COPY" additional to "csv" and "text" would be nice. As it is, I need tool like sed or awk in a pipeline for import (and in special cases for export) instead of direkt copy from file or stdin.
Have you taken a look at PipelineDB?