Re: merging some features from plpgsql2 project

From: Marko Tiikkaja <marko(at)joh(dot)to>
To: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>
Cc: Joel Jacobson <joel(at)trustly(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Merlin Moncure <mmoncure(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: merging some features from plpgsql2 project
Date: 2017-01-09 23:30:16
Message-ID: CAL9smLCmHCJBuH+2FMcZMb_yjTMf6s7gaEhtV6VW9aoQWzBwTg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 9, 2017 at 12:37 AM, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com> wrote:

> If we're going to create a brand new language then I think it would be
> extremely foolish to keep *any* of the current pain points around. Off the
> top of my head:
>
> - variables must have an identifier (what $ in most languages does). The
> steps you have to go through to avoid simple naming collisions are insane.
>

This is exactly what we did not want to do with this project. The idea is
to create a language which is really close to PL/PgSQL, but removes some of
the brain diarrhoea currently present.

Now, this *is* a problem, and the solution we had (well I, mostly, at this
point) in mind is to use the underscore prefix for all input variables and
make OUT parameters invisible to queries inside function bodies unless
explicitly prefixed with OUT. As far as I can tell this eliminates most
if not all collisions while staying almost completely compatible with
arguably well-written PL/PgSQL 1.

- Support for the notion of a variable being unset (which is NOT the same
> thing as NULL).
>

My idea was that the currently unsupported combination of NOT NULL and no
DEFAULT would mean "has to be assigned to a non-NULL value before it can be
read from, or an exception is thrown". Solves the most common use case and
is backwards compatible.

.m

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2017-01-09 23:33:39 Re: merging some features from plpgsql2 project
Previous Message Merlin Moncure 2017-01-09 23:12:54 Re: merging some features from plpgsql2 project