Re: Javascript support in the backend, i.e. PL/JS - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Javascript support in the backend, i.e. PL/JS
Date
Msg-id 12836.1195228615@sss.pgh.pa.us
Whole thread Raw
In response to Javascript support in the backend, i.e. PL/JS  (Sam Mason <sam@samason.me.uk>)
Responses Re: Javascript support in the backend, i.e. PL/JS  (Sam Mason <sam@samason.me.uk>)
List pgsql-hackers
Sam Mason <sam@samason.me.uk> writes:
> For SPI, I'm thinking that I'd currently like to attempt some object
> orientated style interface. ...
> So running some SQL would probably look something like:

>   for (row in spi.prepare("SELECT 1 AS n").query()) {
>     print(row.n);
>   }

What's not apparent to me is how one can avoid re-planning the query
every single time the function is called?

More generally, I think that the average programmer would rather just
not be bothered with all these details; he'd want to write
 for (row in spi.query("...sql..." [, arguments])) { ...

I don't object to exposing the machinery for those who like to play with
such stuff, but you should have shortcuts to keep the simple things
simple.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Mark Mielke
Date:
Subject: Off-Topic: Float point division academia? (was: Re: Spinlock backoff algorithm)
Next
From: Tom Lane
Date:
Subject: Re: [COMMITTERS] pgsql: update files for beta3