Re: [HACKERS] proposal: schema variables

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Pavel Luzanov <p(dot)luzanov(at)postgrespro(dot)ru>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Pavel Golub <pavel(at)gf(dot)microolap(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] proposal: schema variables
Date: 2018-03-23 05:37:58
Message-ID: CAFj8pRA6uCbR=rJvnSN1NVe9JAQZrOXzf2xXAKbvNtShG-=2iA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2018-03-21 6:24 GMT+01:00 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:

>
>
> 2018-03-20 18:38 GMT+01:00 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
>
>> Hi
>>
>> I am sending new update. The code is less ugly, and the current
>> functionality is +/- final for first stage. It should be good enough for
>> playing and testing this concept.
>>
>> What is supported:
>>
>> 1. scalar, composite and array variables
>> 2. composite can be defined on place or some composite type can be used
>> 3. variable, or any field of variable, can have defined default value
>> 4. variable is database object - the access rights are required
>> 5. the values are stored in binary form with defined typmod
>>
>> An usage is very simple:
>>
>> postgres=# create variable foo as numeric default 0;
>> CREATE VARIABLE
>> postgres=# select foo;
>> ┌─────┐
>> │ foo │
>> ╞═════╡
>> │ 0 │
>> └─────┘
>> (1 row)
>>
>> postgres=# let foo = pi();
>> LET
>> postgres=# select foo;
>> ┌──────────────────┐
>> │ foo │
>> ╞══════════════════╡
>> │ 3.14159265358979 │
>> └──────────────────┘
>> (1 row)
>>
>> postgres=# create variable boo as (x numeric default 0, y numeric default
>> 0);
>> CREATE VARIABLE
>> postgres=# let boo.x = 100;
>> LET
>> postgres=# select boo;
>> ┌─────────┐
>> │ boo │
>> ╞═════════╡
>> │ (100,0) │
>> └─────────┘
>> (1 row)
>>
>> postgres=# select boo.x;
>> ┌─────┐
>> │ x │
>> ╞═════╡
>> │ 100 │
>> └─────┘
>> (1 row)
>>
>> Please try it.
>>
>
> small fix - support for SQL functions
>
>

the patch is in commit fest list https://commitfest.postgresql.org/18/1608/

Regards

Pavel

>
>> Regards
>>
>> Pavel
>>
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Laurenz Albe 2018-03-23 07:00:39 Re: Removing useless DISTINCT clauses
Previous Message Pavan Deolasee 2018-03-23 04:57:30 Re: [HACKERS] MERGE SQL Statement for PG11