On Wed, Mar 8, 2017 at 9:13 AM, Karl Czajkowski <karlcz@isi.edu> wrote:
With the temporary table, you can use SQL for most validation or data interrogation, but you need to know at least enough schema information in advance to form the COPY statement. Parsing the CSV header row to plan your work puts you right back to requiring a robust CSV parser unless you can constrain your input scenarios to only handle very trivial headers.
You can write the entire contents of the CSV into a psql variable and process the text blob from there using intermediate arrays.