Skip site navigation (1) Skip section navigation (2)

pl/python table functions

From: Jan Urbański <wulczer(at)wulczer(dot)org>
To: Postgres - Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: pl/python table functions
Date: 2010-12-23 14:00:04
Message-ID: 4D1355E4.2010309@wulczer.org (view raw or flat)
Thread:
Lists: pgsql-hackers
Here's a patch implementing table functions mentioned in
http://archives.postgresql.org/pgsql-hackers/2010-12/msg01991.php. It's
an incremental patch on top of the plpython-refactor patch sent eariler.

Git branch for this patch:
https://github.com/wulczer/postgres/tree/table-functions.

This allows functions with multiple OUT parameters returning both one or
multiple records (RECORD or SETOF RECORD). There's one inconvenience,
which is that if you return a record that has fields of composite types,
the I/O functions for these types will be looked up on each execution.
Changing that would require some juggling of the PL/Python structures,
so I just left it at that.

Note that returning just the composite type (or a set of them) does
cache the I/O funcs. You get the repeated lookups only if the function
returns an unnamed record, that has composite field among others, so
something like

CREATE FUNCTION x(OUT x table_type, OUT y integer) RETURNS RECORD

which I think is fairly uncommon.

Cheers,
Jan


Attachment: plpython-table-functions.diff
Description: text/x-patch (30.9 KB)

pgsql-hackers by date

Next:From: Kenneth MarshallDate: 2010-12-23 14:03:00
Subject: Re: Why is sorting on two columns so slower than sortingon one column?
Previous:From: Jan UrbańskiDate: 2010-12-23 13:56:03
Subject: pl/python tracebacks

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group