From: Guyren Howe <guyren@gmail.com>
To: Merlin Moncure <mmoncure@gmail.com>
Cc: PG-General Mailing List <pgsql-general@postgresql.org>
Subject: Re: Can we go beyond the standard to make Postgres radically better?
Date: Thu, 10 Feb 2022 11:40:04 -0800
Message-ID: <4e3f0ff8-6a5a-4f57-b5c0-f87b99f55dc7@Spark> (raw)
In-Reply-To: <CAHyXU0zxpGmyTp+9TR6zemB8P1_fCVMrz0Hq5Rf4NB_BKapvXQ@mail.gmail.com>
References: <7117322c-185c-4283-990d-6646d8476409@Spark>
<F04BD036-073C-42AD-B308-43D21C75024B@gmail.com>
<CAHyXU0yXEfz8qAHQDLmvgzBJsTb_Oh8p65FE-X7VhzJJpj2gcw@mail.gmail.com>
<CAHyXU0zxpGmyTp+9TR6zemB8P1_fCVMrz0Hq5Rf4NB_BKapvXQ@mail.gmail.com>
I’d like to point out that sum types would be great.
(Sum types let you have any of two or more different types in one value)
For example, I could work around the issues with NULL by defining an enumeration type with values like MISSING, UNKNOWN, INVALID, … and then I can have a column that is a sum of that type with the type we normally keep in the column.
We would need some machinery to declare how aggregates work, but I think that’s very much in the spirit of how types work in Postgres now.
In general, I would think we could make SQL a better functional programming language by just implementing good fp features like this.
On Feb 10, 2022, 11:09 -0800, Merlin Moncure <mmoncure@gmail.com>, wrote:
> On Thu, Feb 10, 2022 at 10:54 AM Merlin Moncure <mmoncure@gmail.com> wrote:
> > > On Wed, Feb 9, 2022 at 11:15 PM Guyren Howe <guyren@gmail.com> wrote:
> > > > >
> > > > >
> > > > > • Also nested function definitions, so top-level functions can be built out of local auxiliary functions.
> > > > > • Other languages
> > > > > • Tutorial D, Datalog, Quell, let’s open this puppy up!
> > > > > • SQL is a terrible, no good, very bad language
> > > > >
> > > > Postgres used to suport QUEL way back in the day. Being blunt, there is zero chance of this happening in core. A query language translator out of core, preprocessing the language into SQL, might work. SQL has evolved far beyond what those languages could practically offer. Main benefit here would be to better support relational division, which bizarrely has yet to arrive in SQL.
> > > > A portable, low-level API
> >
> > FYI, there was a semi-serious commercial attempt to do this back in 2001, Dataphor. It's been opensourced. Wikipedia has a pretty good write up on it:
> > https://en.wikipedia.org/wiki/Dataphor
> >
> > IMNSHO suggestions like these should travel this technical path; take the data language you want and translate it into SQL. Some of these translations will end up being complicated (read: slow). Iterating this kind of thing outside of core would allow for faster development.
> >
> > merlin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: guyren@gmail.com, mmoncure@gmail.com
Subject: Re: Can we go beyond the standard to make Postgres radically better?
In-Reply-To: <4e3f0ff8-6a5a-4f57-b5c0-f87b99f55dc7@Spark>
References: <7117322c-185c-4283-990d-6646d8476409@Spark> <F04BD036-073C-42AD-B308-43D21C75024B@gmail.com> <CAHyXU0yXEfz8qAHQDLmvgzBJsTb_Oh8p65FE-X7VhzJJpj2gcw@mail.gmail.com> <CAHyXU0zxpGmyTp+9TR6zemB8P1_fCVMrz0Hq5Rf4NB_BKapvXQ@mail.gmail.com> <4e3f0ff8-6a5a-4f57-b5c0-f87b99f55dc7@Spark>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox