From: | zkbp712 <zkbp712(at)proton(dot)me> |
---|---|
To: | "mysql(at)mysql(dot)com" <mysql(at)mysql(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | [Feature Request] Support INSERT ... FROM ... TO for date ranges |
Date: | 2025-07-17 01:11:14 |
Message-ID: | lPLMZdNV2uzTI3sEHqF6zdFTOgIpKulgfD7UipFlKJ8TibiIoM3pG75AWnvblj6QgfA_WrJpdUvalXm8v2WfXxrRacGbC2_dWYTPawiEu8s=@proton.me |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Dear MySQL/PostgreSQL Development Teams,
My nameis T-RegExr (Tyrannosaurus RegExr), and I am a developer working extensively withtime-series data such as medication dosages and other daily records.
I would liketo propose a feature enhancement to simplify the insertion of multiple rowsover a continuous daterange.
Problem:
Currently, inserting records for each datein a range requires manually writing multiple INSERT statements orusingexternal scripts to generate these queries. This approach complicates workflows, reduces readability, and increases the chance of errors.
Proposed Syntax:
INSERT INTO dosage (medication_id, amount, date)
VALUES (5, 3, FROM'2025-04-01'TO'2025-04-30');
This syntax would automatically expand internally toinsert one row per datein the range:
(5, 3, '2025-04-01'),
(5, 3, '2025-04-02'),
...
(5, 3, '2025-04-30')
Benefits:
Reduces verbosity and complexity inSQL scripts
Improves developer productivity and code readability
Avoids reliance onexternal scripting languages for common date-range inserts
Especially useful in domains such as healthcare, education, IoT, and others involving time-series data
Alternative (optional) syntax idea:
INSERT INTO dosage (medication_id, amount, date)
GENERATE RANGE (5, 3, '2025-04-01', '2025-04-30');
Inspiration:
PostgreSQL's generate_series() is a powerful function for generating sequences, but it requires more complex SQL usage and is not directly integrated into the INSERT syntax for repeated values across date ranges.
This proposal aims to bring native, first-class support for inserting repeated values over date intervals, making the language more expressive and the workflow simpler.
Thank you very much for considering this enhancement.
Best regards,T-RegExr (Tyrannosaurus RegExr)
From | Date | Subject | |
---|---|---|---|
Next Message | Yugo Nagata | 2025-07-17 01:57:36 | Re: psql: tab-completion support for COPY ... TO/FROM STDIN, STDOUT, and PROGRAM |
Previous Message | Richard Guo | 2025-07-17 01:01:26 | Re: duplicate line in ExecEvalJsonCoercionFinish |