Re: [HACKERS] merging some features from plpgsql2 project

Поиск
Список
Период
Сортировка
От Jim Nasby
Тема Re: [HACKERS] merging some features from plpgsql2 project
Дата
Msg-id 28720fbc-9804-3a14-bbb0-1a2b24cbbdd7@BlueTreble.com
обсуждение исходный текст
Ответ на Re: [HACKERS] merging some features from plpgsql2 project  (Marko Tiikkaja <marko@joh.to>)
Ответы Re: [HACKERS] merging some features from plpgsql2 project  (Marko Tiikkaja <marko@joh.to>)
Список pgsql-hackers
On 1/9/17 5:30 PM, Marko Tiikkaja wrote:
>
> 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.

As a general comment, ISTM it'd be much better to do as much as we can 
in the current language then. It's going to take a LOT to get people to 
switch to a different language, so there needs to be a LOT of added value.

> 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.

That might be workable... it's still rather ugly though.

I don't see prefixing everything with _ as being useful though; people 
can already do that if they want to uglify the function's argument names.

I do think there's stuff that could be done along these lines with 
namespaces though. Allowing users to rename the namespace that arguments 
went into would be a huge step forward. I think having a separate 
namespace for all the automatic variables would be a big help too.

Amusingly, that would allow users to set the namespace to '$', which 
would (almost) give you $variable.

>     - 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.

That won't allow you to use a variable in multiple places though... is 
there a reason we couldn't support something like IS DEFINED and UNSET?
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: [HACKERS] Make pg_basebackup -x stream the default
Следующее
От: Marko Tiikkaja
Дата:
Сообщение: Re: [HACKERS] merging some features from plpgsql2 project