pgsql: Following up a previous thought I had, yesterday I realised how

Поиск
Список
Период
Сортировка
От momjian@svr1.postgresql.org (Bruce Momjian)
Тема pgsql: Following up a previous thought I had, yesterday I realised how
Дата
Msg-id 20050710153247.E9EAF528B7@svr1.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Log Message:
-----------
Following up a previous thought I had, yesterday I realised how to
return arays nicely without having to make the plperl programmer aware
of anything. The attached patch allows plperl to return an arrayref
where the function returns an array type. It silently calls a perl
function to stringify the array before passing it to the pg array
parser. Non-array returns are handled as before (i.e. passed through
this process) so it is backwards compatible. I will presently submit
regression tests and docs.

example:

andrew=# create or replace function blah() returns text[][] language
plperl as $$ return [['a"b','c,d'],['e\\f','g']]; $$;
CREATE FUNCTION
andrew=# select blah();
            blah
-----------------------------
 {{"a\"b","c,d"},{"e\\f",g}}


This would complete half of the TODO item:

  . Pass arrays natively instead of as text between plperl and postgres

(The other half is translating pg array arguments to perl arrays - that
will have to wait for 8.1).

Some of this patch is adapted from a previously submitted patch from
Sergej Sergeev. Both he and Abhijit Menon-Sen have looked it over
briefly and tentatively said it looks ok.

Andrew Dunstan

Modified Files:
--------------
    pgsql/src/pl/plperl:
        plperl.c (r1.82 -> r1.83)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/pl/plperl/plperl.c.diff?r1=1.82&r2=1.83)

В списке pgsql-committers по дате отправления:

Предыдущее
От: momjian@svr1.postgresql.org (Bruce Momjian)
Дата:
Сообщение: pgsql: The attached patch implements spi_query() and spi_fetchrow()
Следующее
От: momjian@svr1.postgresql.org (Bruce Momjian)
Дата:
Сообщение: pgsql: Remove #include as compile fix.