Unix Technical Forum

Packages in oracle Style

This is a discussion on Packages in oracle Style within the pgsql Hackers forums, part of the PostgreSQL category; --> I want to start working to implement packages in PostgreSQL and would like to learn how to change the ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-29-2008, 10:42 AM
Coutinho
 
Posts: n/a
Default 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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-29-2008, 10:43 AM
Zdenek Kotala
 
Posts: n/a
Default Re: Packages in oracle Style

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-29-2008, 10:43 AM
Coutinho
 
Posts: n/a
Default Re: Packages in oracle Style

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.

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-29-2008, 10:43 AM
Zdenek Kotala
 
Posts: n/a
Default Re: Packages in oracle Style

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-29-2008, 10:43 AM
Pavel Stehule
 
Posts: n/a
Default Re: Packages in oracle Style

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
>


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 06-02-2008, 01:36 PM
coutinho@mondriantecnologia.com
 
Posts: n/a
Default Re: Packages in oracle Style


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.c om');

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
>>



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 06-02-2008, 01:36 PM
Joe Conway
 
Posts: n/a
Default Re: Packages in oracle Style

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 06-02-2008, 01:36 PM
Pavel Stehule
 
Posts: n/a
Default Re: Packages in oracle Style

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.c om');
>
> 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
>>>

>
>


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 06-02-2008, 01:36 PM
Harald Armin Massa
 
Posts: n/a
Default Re: Packages in oracle Style

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!

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:48 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com