public inbox for pgsql-performance@postgresql.org  
help / color / mirror / Atom feed
From: Pavel Stehule <pavel.stehule@gmail.com>
To: Pavel Luzanov <p.luzanov@postgrespro.ru>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: Pavel Golub <pavel@gf.microolap.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] proposal: schema variables
Date: Wed, 21 Mar 2018 06:24:16 +0100
Message-ID: <CAFj8pRBStff3KBB3m005D8+mQc=3tFATB+D_ND9g_mARdO=aXA@mail.gmail.com> (raw)
In-Reply-To: <CAFj8pRAHK-6fPiyBGtTCjm4EOXc5ixgjL5ji5933cV3sS58nrQ@mail.gmail.com>
References: <CAFj8pRDY+m9OOxfO10R7J0PAkCCauM-TweaTrdsrsLGMb1VbEQ@mail.gmail.com>
	<623395617.20171113141500@gf.microolap.com>
	<CAFj8pRDdS7ViLBJ6eA93u=C_x15EBv2deiNQDGkBS=LNrjzLLw@mail.gmail.com>
	<CAFj8pRBfb-GTZSHSRVTpMzGr26-7e-_RmOmRpmuk+xuDTgC=mA@mail.gmail.com>
	<CAKFQuwa00-4HTujbnYNy_OdZ2OfjUO3AX4R91DbQ1wPBZegCfg@mail.gmail.com>
	<CAFj8pRBchBfyPKAVPnJKhDjh7r6kTJ9L1=etMt-pjdDzpsKOUA@mail.gmail.com>
	<CAFj8pRCTsxzsxX1cWgX3cjqsSZb=gqOMd3-2FdbGz5a2+shGMg@mail.gmail.com>
	<CAFj8pRA6YWwV=sZj5iSgDUixr-S+u9W2+v0BJqqxHQDXS2oZww@mail.gmail.com>
	<dde8f23f-a15f-e88b-482e-5c26cce14cca@postgrespro.ru>
	<CAFj8pRDLBtPM9PAVx-VFtLyZJktKL5R4hX4V4O4KvcyjbOPRbw@mail.gmail.com>
	<ef39f19b-9d5c-78d1-6afa-adbe1288a20b@postgrespro.ru>
	<CAFj8pRAY1KL-yA+ENCdOv+iJgVua773B_rq+Q=gkeUWg5yoLMA@mail.gmail.com>
	<CAFj8pRAHK-6fPiyBGtTCjm4EOXc5ixgjL5ji5933cV3sS58nrQ@mail.gmail.com>

2018-03-20 18:38 GMT+01:00 Pavel Stehule <pavel.stehule@gmail.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


>
> Regards
>
> Pavel
>


Attachments:

  [application/octet-stream] schema-variables-poc-180321-01-diff (174.3K, 3-schema-variables-poc-180321-01-diff)
  download

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: pavel.stehule@gmail.com, p.luzanov@postgrespro.ru, david.g.johnston@gmail.com, pavel@gf.microolap.com, pgsql-hackers@postgresql.org
  Subject: Re: [HACKERS] proposal: schema variables
  In-Reply-To: <CAFj8pRBStff3KBB3m005D8+mQc=3tFATB+D_ND9g_mARdO=aXA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox