Group: pgsql.hackers


Subject: Javascript support in the backend, i.e. PL/JS
From: tgl@sss.pgh.pa.us (Tom Lane)
Date: 11/16/2007 10:56:55 AM
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 ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Subject: Javascript support in the backend, i.e. PL/JS
From: tgl@sss.pgh.pa.us (Tom Lane)
Date: 11/16/2007 12:18:09 PM
Sam Mason <sam@samason.me.uk> writes: > On Fri, Nov 16, 2007 at 10:56:55AM -0500, Tom Lane wrote: >> 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])) { ... > OK. Would you expect this to use cursors under the hood? I can't see a > good way of making this work without them unless I accept that they're > going to fail if the record set gets too large. Yeah, you want it to "just work" ... regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org