Sample Header Ad - 728x90

Writing CSV directly to a BYTEA column from PostgreSQL tables

0 votes
0 answers
524 views
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.).
Asked by crdb (1 rep)
Apr 18, 2019, 04:49 AM