Обсуждение: Packages in oracle Style
I want to start working to implement packages in PostgreSQL and would like to learn how to change the tables of the catalogue. I want to useit pg_namespace table to create a "sub-schema" that will be used to group the functions like in Oracle -- Nabucodonosor Coutinho
Coutinho napsal(a):
> I want to start working to implement packages in PostgreSQL and would
> like to learn how to change the tables of the catalogue.
>
> I want to useit pg_namespace table to create a "sub-schema" that will be used to
> group the functions like in Oracle
Please, look into conference archive. This was discussed several times and IIRC
every time it has been rejected.
Zdenek
this is listed on TODO: http://www.postgresql.org/docs/faqs.TODO.html Add features of Oracle-style packages (Pavel) A package would be a schema with session-local variables, public/private functions, and initialization functions. It is also possible to implement these capabilities in any schema and not use a separate "packages" syntax at all. Indeed not seek approval but help. I am implementing this now to my use and for those who have interest, perhaps in the form of a patch or contrib.
Coutinho napsal(a): > this is listed on TODO: > http://www.postgresql.org/docs/faqs.TODO.html > > Add features of Oracle-style packages (Pavel) > I see. Sorry I overlooked it. I think Pavel Stehule will help you. He has idea how to do it. Zdenek
2008/5/27 Zdenek Kotala <Zdenek.Kotala@sun.com>: > Coutinho napsal(a): >> >> this is listed on TODO: >> http://www.postgresql.org/docs/faqs.TODO.html >> >> Add features of Oracle-style packages (Pavel) >> My last idea was only global variables for plpgsql. It needs hack of plpgsql :(. But it's can be simple work. Pavel > > I see. Sorry I overlooked it. I think Pavel Stehule will help you. He has > idea how to do it. > > Zdenek > > -- > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-hackers >
I have implemented a solution for global variables implemented in plpython and I need implement this in c :)
My implementation:
select set_session('USER','coutinho');
select set_session('EMAIL','coutinho@mondriantecnologia.com');
select get_session('USER');
> coutinho
select get_session('EMAIL');
> coutinho@mondriantecnologia.com
On Wed, 28 May 2008 22:13:31 +0200, "Pavel Stehule" <pavel.stehule@gmail.com> wrote:
> 2008/5/27 Zdenek Kotala <Zdenek.Kotala@sun.com>:
>> Coutinho napsal(a):
>>>
>>> this is listed on TODO:
>>> http://www.postgresql.org/docs/faqs.TODO.html
>>>
>>> Add features of Oracle-style packages (Pavel)
>>>
>
> My last idea was only global variables for plpgsql. It needs hack of
> plpgsql :(. But it's can be simple work.
>
> Pavel
>
>>
>> I see. Sorry I overlooked it. I think Pavel Stehule will help you. He
> has
>> idea how to do it.
>>
>> Zdenek
>>
>> --
>> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-hackers
>>
coutinho@mondriantecnologia.com wrote: > I have implemented a solution for global variables implemented in plpython and I need implement this in c :) The below listed tarball is out of date at this point, but I have updated code laying around if someone really wanted it: http://www.joeconway.com/sessfunc.tar.gz I've used variations of this over the years on several projects. I've also (mis)used custom configs, e.g. in a plpgsql function: 8<---------------------------- EXECUTE 'set myvars.var1 to ''' || p_var1 || ''''; 8<---------------------------- and in your "get session var" C function: 8<---------------------------- #define GET_SESSVAR_BY_NAME(SESS_VAR_NAME) \ do { \ SESS_VAR_NAME = GetConfigOptionByName("myvars." #SESS_VAR_NAME,\ NULL); \ if (!SESS_VAR_NAME) \ elog(ERROR,"Missing session variable: " #SESS_VAR_NAME); \ } while (0) char *var1 = GET_SESSVAR_BY_NAME(var1); 8<---------------------------- Joe
Hello
2008/5/31 <coutinho@mondriantecnologia.com>:
>
> I have implemented a solution for global variables implemented in plpython and I need implement this in c :)
>
> My implementation:
>
> select set_session('USER','coutinho');
> select set_session('EMAIL','coutinho@mondriantecnologia.com');
>
> select get_session('USER');
>> coutinho
>
> select get_session('EMAIL');
>> coutinho@mondriantecnologia.com
>
>
this is too simple :( data are stored in text format, not in native Datum format
Regards
Pavel Stehule
> On Wed, 28 May 2008 22:13:31 +0200, "Pavel Stehule" <pavel.stehule@gmail.com> wrote:
>> 2008/5/27 Zdenek Kotala <Zdenek.Kotala@sun.com>:
>>> Coutinho napsal(a):
>>>>
>>>> this is listed on TODO:
>>>> http://www.postgresql.org/docs/faqs.TODO.html
>>>>
>>>> Add features of Oracle-style packages (Pavel)
>>>>
>>
>> My last idea was only global variables for plpgsql. It needs hack of
>> plpgsql :(. But it's can be simple work.
>>
>> Pavel
>>
>>>
>>> I see. Sorry I overlooked it. I think Pavel Stehule will help you. He
>> has
>>> idea how to do it.
>>>
>>> Zdenek
>>>
>>> --
>>> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
>>> To make changes to your subscription:
>>> http://www.postgresql.org/mailpref/pgsql-hackers
>>>
>
>
Joe and all, > The below listed tarball is out of date at this point, but I have updated > code laying around if someone really wanted it: > http://www.joeconway.com/sessfunc.tar.gz > I've used variations of this over the years on several projects. is someone able and willing to provide this tarball compiled to a PostgreSQL-8.3.1 usable win32-dll ? ATM I am using session variables in pure PL/SQL via temp tables. ..:) Harald -- GHUM Harald Massa persuadere et programmare Harald Armin Massa Spielberger Straße 49 70435 Stuttgart 0173/9409607 no fx, no carrier pidgeon - EuroPython 2008 will take place in Vilnius, Lithuania - Stay tuned!
2008/6/1 Harald Armin Massa <haraldarminmassa@gmail.com>: > Joe and all, > >> The below listed tarball is out of date at this point, but I have updated >> code laying around if someone really wanted it: >> http://www.joeconway.com/sessfunc.tar.gz >> I've used variations of this over the years on several projects. > > is someone able and willing to provide this tarball compiled to a > PostgreSQL-8.3.1 usable win32-dll ? > > ATM I am using session variables in pure PL/SQL via temp tables. ..:) > > It should by contrib module Pavel > Harald > > > -- > GHUM Harald Massa > persuadere et programmare > Harald Armin Massa > Spielberger Straße 49 > 70435 Stuttgart > 0173/9409607 > no fx, no carrier pidgeon > - > EuroPython 2008 will take place in Vilnius, Lithuania - Stay tuned! >