From: | Steve Chavez <steve(at)supabase(dot)io> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | csv_populate_recordset and csv_agg |
Date: | 2022-10-24 01:50:11 |
Message-ID: | CAGRrpzbL3RqRN3fTu7-BrOQAYCaxae9QoUvKZXZ0NKyG2z80BA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello hackers,
The `json_populate_recordset` and `json_agg` functions allow systems to
process/generate json directly on the database. This "cut outs the middle
tier"[1] and notably reduces the complexity of web applications.
CSV processing is also a common use case and PostgreSQL has the COPY ..
FROM .. CSV form but COPY is not compatible with libpq pipeline mode and
the interface is clunkier to use.
I propose to include two new functions:
- csv_populate_recordset ( base anyelement, from_csv text )
- csv_agg ( anyelement )
I would gladly implement these if it sounds like a good idea.
I see there's already some code that deals with CSV on
- src/backend/commands/copyfromparse.c(CopyReadAttributesCSV)
- src/fe_utils/print.c(csv_print_field)
- src/backend/utils/error/csvlog(write_csvlog)
So perhaps a new csv module could benefit the codebase as well.
Best regards,
Steve
[1]: https://www.crunchydata.com/blog/generating-json-directly-from-postgres
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Smith | 2022-10-24 01:51:26 | Re: [DOCS] Stats views and functions not in order? |
Previous Message | Tom Lane | 2022-10-24 01:01:40 | Re: [PATCH] minor bug fix for pg_dump --clean |