Re: [HACKERS] merging some features from plpgsql2 project - Mailing list pgsql-hackers

From Marko Tiikkaja
Subject Re: [HACKERS] merging some features from plpgsql2 project
Date
Msg-id CAL9smLCmHCJBuH+2FMcZMb_yjTMf6s7gaEhtV6VW9aoQWzBwTg@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] merging some features from plpgsql2 project  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Responses Re: [HACKERS] merging some features from plpgsql2 project  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
List pgsql-hackers
On Mon, Jan 9, 2017 at 12:37 AM, Jim Nasby <Jim.Nasby@bluetreble.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

pgsql-hackers by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: [HACKERS] merging some features from plpgsql2 project
Next
From: Andrew Dunstan
Date:
Subject: Re: [HACKERS] merging some features from plpgsql2 project