<p>Struggling to wrap my brain around this one...</p>

<p>So I need to execute a Postgres <code>COPY</code> command in a PHP program like the following:</p>

<pre><code>COPY _data_20200404_193855 FROM '/mnt/files/imports/CopyFlatFile.csv.tab' DELIMITER E'\t' CSV HEADER
</code></pre>

<p>The <code>/mnt/files/xls-imports/CopyFlatFile.csv.tab</code> is the PVC location, but Postgres Pod is thinking it is a location in the Pod, so it says it can't find the file.</p>

<p>I can manually move the file out of the PVC and into the Postgres Pod with a combination of <code>scp</code> and <code>kubectl cp</code> and the command executes perfectly after copying it into pgAdmin and running it.</p>

<p>Not an ideal method and not very efficient as I'd like the program to handle it.</p>

<p>Any suggestions for how to handle this?</p>

<p>Worst case scenario, I rewrite it to construct a massive <code>INSERT INTO</code> statement, but not sure if it can handle that much data being held in memory. If not, I'll just break it into smaller chunks. Oof...</p>

cjones
<p>It looks like I didn't even have my file storage PVC hooked up to the Postgres Deployment... did that and it is now working. Oversight on my part.</p>

<p>Was...</p>

<pre><code>...
          volumeMounts:
            - name: postgres-storage
              mountPath: /var/postgresql
      volumes:
        - name: postgres-storage
          persistentVolumeClaim:
            claimName: postgres-storage
...
</code></pre>

<p>So I changed it to:</p>

<pre><code>...
            - mountPath: /var/postgresql
              name: postgres-storage
            - mountPath: /mnt/files/xls-imports
              name: file-storage
              subPath: xls-imports
      volumes:
        - name: postgres-storage
          persistentVolumeClaim:
            claimName: postgres-storage
        - name: file-storage
          persistentVolumeClaim:
            claimName: file-storage
...
</code></pre>
