Re: Packages in oracle Style

Lists: pgsql-hackers
From: Coutinho <coutinho(at)mondriantecnologia(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Packages in oracle Style
Date: 2008-05-25 16:36:08
Message-ID: 20080525133608.75de451c@python
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: Coutinho <coutinho(at)mondriantecnologia(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Packages in oracle Style
Date: 2008-05-26 18:57:37
Message-ID: 483B0821.7080607@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: Coutinho <coutinho(at)mondriantecnologia(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Packages in oracle Style
Date: 2008-05-27 00:53:41
Message-ID: 20080526215341.1d08b655@python
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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.


From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: Coutinho <coutinho(at)mondriantecnologia(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Packages in oracle Style
Date: 2008-05-27 06:45:09
Message-ID: 483BADF5.9050604@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Zdenek Kotala" <Zdenek(dot)Kotala(at)sun(dot)com>
Cc: Coutinho <coutinho(at)mondriantecnologia(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Packages in oracle Style
Date: 2008-05-28 20:13:31
Message-ID: 162867790805281313s652cc22ex3493d533cf848489@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2008/5/27 Zdenek Kotala <Zdenek(dot)Kotala(at)sun(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>


From: <coutinho(at)mondriantecnologia(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Zdenek Kotala <Zdenek(dot)Kotala(at)sun(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Packages in oracle Style
Date: 2008-05-31 13:20:54
Message-ID: 02389fff58bdfb93f27630ae8e0a8ee0@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: 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(at)mondriantecnologia(dot)com');

select get_session('USER');
> coutinho

select get_session('EMAIL');
> coutinho(at)mondriantecnologia(dot)com

On Wed, 28 May 2008 22:13:31 +0200, "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> wrote:
> 2008/5/27 Zdenek Kotala <Zdenek(dot)Kotala(at)sun(dot)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(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-hackers
>>


From: Joe Conway <mail(at)joeconway(dot)com>
To: coutinho(at)mondriantecnologia(dot)com
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Zdenek Kotala <Zdenek(dot)Kotala(at)sun(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Packages in oracle Style
Date: 2008-05-31 15:32:56
Message-ID: 48416FA8.40008@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

coutinho(at)mondriantecnologia(dot)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


From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: coutinho(at)mondriantecnologia(dot)com
Cc: "Zdenek Kotala" <Zdenek(dot)Kotala(at)sun(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Packages in oracle Style
Date: 2008-05-31 17:37:46
Message-ID: 162867790805311037h718d5dbdtb5f16912abea646f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hello

2008/5/31 <coutinho(at)mondriantecnologia(dot)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(at)mondriantecnologia(dot)com');
>
> select get_session('USER');
>> coutinho
>
> select get_session('EMAIL');
>> coutinho(at)mondriantecnologia(dot)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(dot)stehule(at)gmail(dot)com> wrote:
>> 2008/5/27 Zdenek Kotala <Zdenek(dot)Kotala(at)sun(dot)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(at)postgresql(dot)org)
>>> To make changes to your subscription:
>>> http://www.postgresql.org/mailpref/pgsql-hackers
>>>
>
>


From: "Harald Armin Massa" <haraldarminmassa(at)gmail(dot)com>
To: "Joe Conway" <mail(at)joeconway(dot)com>
Cc: coutinho(at)mondriantecnologia(dot)com, "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>, "Zdenek Kotala" <Zdenek(dot)Kotala(at)sun(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Packages in oracle Style
Date: 2008-06-01 08:04:48
Message-ID: 7be3f35d0806010104q454e682crc5f0ea34df7ddad8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: 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!


From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Harald Armin Massa" <haraldarminmassa(at)gmail(dot)com>
Cc: "Joe Conway" <mail(at)joeconway(dot)com>, coutinho(at)mondriantecnologia(dot)com, "Zdenek Kotala" <Zdenek(dot)Kotala(at)sun(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Packages in oracle Style
Date: 2008-06-01 09:08:51
Message-ID: 162867790806010208j325412c7k14579d060aedff9e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2008/6/1 Harald Armin Massa <haraldarminmassa(at)gmail(dot)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!
>