Обсуждение: [HACKERS] Embedding scripting

Поиск
Список
Период
Сортировка

[HACKERS] Embedding scripting

От
bibach@execpc.com
Дата:
   Just a little idea to help give everyone's mind a break from 6.1
issues for a moment.  This would probably be a 7.0 thing, depending on
how the releases go.
   Has anyone thought of making use of an embedded scripting package
in PostgreSQL?  This would be something along the lines of TCL or
Guile.  I'd lean towards Guile, personally, as it seems the most
flexible.  Guile is an embeddable Scheme (a dialect of Lisp)
interpreter.  The nice thing about it is that the version of Scheme
that it implements is powerful enough to "emulate", if you will, other
languages.  In fact, the guys who put Guile together have already
implemented what they call CTAX, which is a syntax very similar to C.
   I'm thinking we could intergrate this in with the Postgres parser
(and probably the SQL Function managing code) to give us all sorts of
new tricks.  For instance, this might be a nice, easy, powerful way to
implement some of the extensions to SQL that many commericial packages
have (ie, variables, loops, conditionals, etc).
   What does everyone think of something like this?

- -Brandon :)

------------------------------

Re: [HACKERS] Embedding scripting

От
Igor
Дата:
We don't even have embedded SQL...Maybe we should do that first...


=+=------------------------/\---------------------------------=+=
       Igor Natanzon      |**|   E-mail: igor@sba.miami.edu
=+=------------------------\/---------------------------------=+=

On Tue, 3 Jun 1997 bibach@execpc.com wrote:

>    Just a little idea to help give everyone's mind a break from 6.1
> issues for a moment.  This would probably be a 7.0 thing, depending on
> how the releases go.
>    Has anyone thought of making use of an embedded scripting package
> in PostgreSQL?  This would be something along the lines of TCL or
> Guile.  I'd lean towards Guile, personally, as it seems the most
> flexible.  Guile is an embeddable Scheme (a dialect of Lisp)
> interpreter.  The nice thing about it is that the version of Scheme
> that it implements is powerful enough to "emulate", if you will, other
> languages.  In fact, the guys who put Guile together have already
> implemented what they call CTAX, which is a syntax very similar to C.
>    I'm thinking we could intergrate this in with the Postgres parser
> (and probably the SQL Function managing code) to give us all sorts of
> new tricks.  For instance, this might be a nice, easy, powerful way to
> implement some of the extensions to SQL that many commericial packages
> have (ie, variables, loops, conditionals, etc).
>    What does everyone think of something like this?
>
> -Brandon :)
>

------------------------------

Re: [HACKERS] Embedding scripting

От
darcy@druid.net (D'Arcy J.M. Cain)
Дата:
Thus spake bibach@execpc.com
>    Has anyone thought of making use of an embedded scripting package
> in PostgreSQL?  This would be something along the lines of TCL or
> Guile.  I'd lean towards Guile, personally, as it seems the most
> flexible.  Guile is an embeddable Scheme (a dialect of Lisp)
> interpreter.  The nice thing about it is that the version of Scheme
> that it implements is powerful enough to "emulate", if you will, other
> languages.  In fact, the guys who put Guile together have already
> implemented what they call CTAX, which is a syntax very similar to C.
>    I'm thinking we could intergrate this in with the Postgres parser
> (and probably the SQL Function managing code) to give us all sorts of
> new tricks.  For instance, this might be a nice, easy, powerful way to
> implement some of the extensions to SQL that many commericial packages
> have (ie, variables, loops, conditionals, etc).
>    What does everyone think of something like this?

I find that the Tcl package works pretty good as a 4GL for me.  Perhaps
we can look at adding more functionality to make it simpler.  That was
the idea behind my pg_select command.  It makes a very simple loop.

I have also done a lot of stuff for embedding forms into the database
but it is all based on external tables.  I talked about this before
but it was put off till after the next release.  Perhaps we can reopen
that discussion now.

If anyone wants to see what I have, look at http://www.druid.net/darcy/tcldb/.

- --
D'Arcy J.M. Cain                           |  Democracy is three wolves
darcy@{druid.net|vex.net}                  |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.
                --  http://www.druid.net/darcy  --

------------------------------

Re: [HACKERS] Embedding scripting

От
hal@vailsys.com (Hal Snyder)
Дата:
On Tue, 3 Jun 1997 18:31:48 -0500 (CDT), bibach@execpc.com wrote:

>   Has anyone thought of making use of an embedded scripting package
>in PostgreSQL?  This would be something along the lines of TCL or
>Guile.  I'd lean towards Guile, personally, as it seems the most
>flexible.  Guile is an embeddable Scheme (a dialect of Lisp)
>interpreter. ...

Sounds good to me!

>   I'm thinking we could intergrate this in with the Postgres parser
>(and probably the SQL Function managing code) to give us all sorts of
>new tricks.  For instance, this might be a nice, easy, powerful way to
>implement some of the extensions to SQL that many commericial packages
>have (ie, variables, loops, conditionals, etc).

Yes, I think the present parser is far too limited!
Not sure how hard it would be to hook in Guile, tho.

>   What does everyone think of something like this?

Make it an option (like Apache modules?) so people who hate the idea
don't have to link it.  I like the idea of adding a single tool, one
that is already known and tested (?), rather than going through the long
painful develop debug cycle (death of a thousand paper cuts) making ad
hoc extensions to the parser.

BTW, regarding embedded SQL, I personally give this a very low priority.
It just *sounds* intrinsically evil to me - like MS Visual GUIfied
language tools that generate template code with here-dummy comments
where you put in your own stuff.  Blechh.  Just my opinion.

------------------------------

Re: [HACKERS] Embedding scripting

От
bibach@execpc.com
Дата:
Hal Snyder said:
> >   Has anyone thought of making use of an embedded scripting package
> >in PostgreSQL?  This would be something along the lines of TCL or
> >Guile.  I'd lean towards Guile, personally, as it seems the most
> >flexible.  Guile is an embeddable Scheme (a dialect of Lisp)
> >interpreter. ...
> Sounds good to me!
>
> >   I'm thinking we could intergrate this in with the Postgres parser
> >(and probably the SQL Function managing code) to give us all sorts of
> >new tricks.  For instance, this might be a nice, easy, powerful way to
> >implement some of the extensions to SQL that many commericial packages
> >have (ie, variables, loops, conditionals, etc).
> Yes, I think the present parser is far too limited!
> Not sure how hard it would be to hook in Guile, tho.
>
I'm not sure myself.  I've yet to actually use Guile in a project, but
from looking it over, it seems it would be a reasonably easy task,
depending mainly upon how deep into the Postgres internals we want to
let it get.  The other big question is how difficult it will be to
give Guile (Scheme) a SQL face.  I suspect most of this will be
getting the parser to work with Guile.  Not quite sure at this point
how it will all interact.

> >   What does everyone think of something like this?
> Make it an option (like Apache modules?) so people who hate the idea
> don't have to link it.  I like the idea of adding a single tool, one
> that is already known and tested (?), rather than going through the long
> painful develop debug cycle (death of a thousand paper cuts) making ad
> hoc extensions to the parser.
>
Yes, I think it should definately be an option.  I expect there are
all sorts of new possibilities that this would allow.  The only things
I've really thought about are the new capabilities for the query
language and a new type of interface.

> BTW, regarding embedded SQL, I personally give this a very low priority.
> It just *sounds* intrinsically evil to me - like MS Visual GUIfied
> language tools that generate template code with here-dummy comments
> where you put in your own stuff.  Blechh.  Just my opinion.
>
Yeah, never really thought much of the idea myself.  However, I
understand it is used all over the place, so I suppose we will need to
support it somehow, someway.  I suspect embedded SQL will be done via
some C preprocessor.  Not quite sure how it will work.  But that isn't
really all that related here.

- -Brandon :)

------------------------------

Re: [HACKERS] Embedding scripting

От
Linus Tolke
Дата:
Igor <igor@sba.miami.edu> writes:

>
> We don't even have embedded SQL...Maybe we should do that first...

I have made a small package that makes it possible to write embedded
sql in C for postgres. I have used it for my own pet project and it
seems to work.

I have yet only tried it with postgres95 but I am compiling postgreSQL
right now to test it there.

If you wan't to have a look at my work take a peek at:
    ftp://ftp.lysator.liu.se/pub/linus/ecpg-0.1-alpha-1.tar.gz

    /Linus

------------------------------

Re: [HACKERS] Embedding scripting

От
"Brian E. Gallew"
Дата:
>    Has anyone thought of making use of an embedded scripting package
> in PostgreSQL?  This would be something along the lines of TCL or
> Guile.

I'd prefer Python, but that's just me.

In any case, this has both good and bad points, and can actually be
circumvented.  We already have facilities for adding random extensions to the
database (e.g. CREATE FUNCTION lang='C').  While I don't know much about Guile,
both Tk/Tcl and Python can be embedded almost trivially on systems which
support dynamic loading.  Of course, for more functionality, you'd need to to
also link in libpgtcl (for Tcl) and/or Pygress.  This basically just moves
things from the front end to the back end.  Of course, there will probably be
namespace issues and so forth, but it's fairly easy (compared with, say,
Vadim's work with indices).

BTW, since I'm already here, I'd like to thank Marc, Bruce, Vadim, et al for
the great work on this product.  I'd hire any of you to work for me (assuming I
was in such a position)!


=====================================================================
| Please do not shoot at the thermonuclear weapons! -- Deacon       |
=====================================================================
| Finger geek@andrew.cmu.edu for my public key.                     |
=====================================================================

------------------------------