Re: [HACKERS] rule system, perl and other good stuff

From: "Vadim B(dot) Mikheev" <vadim(at)sable(dot)krasnoyarsk(dot)su>
To: Brett McCormick <brett(at)work(dot)chicken(dot)org>
Cc: pgsql-hackers(at)hub(dot)org, scrappy(at)hub(dot)org, wieck(at)sapserv(dot)debis(dot)de
Subject: Re: [HACKERS] rule system, perl and other good stuff
Date: 1998-02-11 08:19:48
Message-ID: 34E15F24.CD8BC514@sable.krasnoyarsk.su
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Brett McCormick wrote:
>
> I don't see CREATE LANGUAGE in the grammar file... are you asking if
> it is strictly compatible or if it uses the dynamic language interface?
> there's no reason it shouldn't be compatible..
...
> DOH -- that's another question I meant to ask, as I noticed some
> things in the new (6.3) code about it.. no, it isn't, it is hacked in
> just like fmgr_dynamic is.. what do I need to know about the create
> language interface.. any docs?
...
> okay... yes it can co-exist with CREATE LANGUAGE as long as it is
> coded into the server like fmgr_dynamic is. it will not function as a
> CREATE LANGUAGE function. this is because all that this functionality
> appears to do is associate a single function with a language. but it
> does not pass the prosrc attribute (or probin for that matter) to the
> function, so no matter what you say for as 'insert code here', it
> never gets to the function, so the function has no idea what to do!

Sorry: CREATE PLangTrusted PROCEDURAL LANGUAGE...

PL handler function has to be created (via CREATE FUNCTION)
before language creation..

After that you are able to do something like this (having PL/tcl):

create function overpaid_2 (EMP)
returns bool as '
if {200000.0 < $EMP(salary)} {
return 't'
}
if {$EMP(age) < 30 && 100000.0 < $EMP(salary)} {
return 't'
}
return 'f'
' language 'pltcl';
^^^^^^^^^^^^^^^^
^^^^^^^ in addition to built-in languages!

Dynamic procedural language interface and support for TCL are
implemented by Jan (wieck(at)sapserv(dot)debis(dot)de) - please contact to him
to get more info (btw, there is create_language.l)...

It would be nice to have support for perl...

BTW, Mark, I don't see PLtcl in current sources.
It would be nice to have it under contrib/pl or, even better, under
src/pl (may be with flag USE_PLTCL in Makefile - like USE_TCL :), -
with automatical installation into template database by initdb).

Vadim

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 1998-02-11 08:20:59 Re: [HACKERS] rule system, perl and other good stuff
Previous Message Brett McCormick 1998-02-11 07:40:41 Re: [HACKERS] rule system, perl and other good stuff