问题
I'm using Postgres 12.
I have 2 files that I want to load into a table via COPY. However, I need the rows from each file to indicate their source. Is there some trick with COPY where I could specify a default value for a column? I can't use the DEFAULT mechanism on the table declaration itself since that'd be universal, not different per file.
The only hack I've come up with so far is running the files through a pre-step to add the column to the raw file, but that's painful as I'm trying to load it directly from S3 without creating intermediate copies (and slow given the file sizes).
来源:https://stackoverflow.com/questions/63905091/postgres-copy-two-files-to-same-table-with-source-indication