Re: [HACKERS] proposal: schema variables
От | Pavel Stehule |
---|---|
Тема | Re: [HACKERS] proposal: schema variables |
Дата | |
Msg-id | CAFj8pRBStff3KBB3m005D8+mQc=3tFATB+D_ND9g_mARdO=aXA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [HACKERS] proposal: schema variables (Pavel Stehule <pavel.stehule@gmail.com>) |
Ответы |
Re: [HACKERS] proposal: schema variables
|
Список | pgsql-hackers |
2018-03-20 18:38 GMT+01:00 Pavel Stehule <pavel.stehule@gmail.com>:
4. variable is database object - the access rights are required3. variable, or any field of variable, can have defined default value2. composite can be defined on place or some composite type can be used1. scalar, composite and array variablesWhat is supported:HiI 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.5. the values are stored in binary form with defined typmodAn 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
RegardsPavel
Вложения
В списке pgsql-hackers по дате отправления: