Assuming these two tables:
CREATE TABLE data (day DATE, kpi INTEGER); CREATE TABLE reports (csv BYTEA);
Is it possible to (pseudocode):
INSERT INTO reports (csv) (SELECT to_csv(SELECT day, kpi FROM data));
with the result being a CSV stored as BYTEA in table reports, column csv?
I specifically do not want to go through the filesystem (COPY, etc.).