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

plperl better array support

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Cc: PL/Perl <plperlng-devel(at)pgfoundry(dot)org>
Subject: plperl better array support
Date: 2005-06-20 09:06:32
Message-ID: 42B68718.5010209@dunslane.net (view raw or flat)
Thread:
Lists: pgsql-patches
The attached patch (submitted for comment) is somewhat adapted from one 
submitted last October. This allows returning a perl array where a 
postgres array is expected.

example:

andrew=# create function blurfl() returns text[] language plperl as $$
andrew$# return ['a','b','c','a"b\c'];
andrew$# $$;
CREATE FUNCTION
andrew=# select blurfl();
      blurfl      
-------------------
 {a,b,c,"a\"b\\c"}


Unlike the patch from October, this patch does not implement ANYARRAY or 
ANYELEMENT pseudotypes. However it does escape/quote array elements 
where necessary. It also preserves the old behaviour (if the plperl 
function returns a string it is just passed through).

I'm not happy about constructing a string which we then parse out again 
into an array - that strikes me as quite inefficient. (And there are 
other inelegancies that I'd like to get rid of.) Much better would be to 
use some array contruction calls directly - any pointers on how to do 
that would be apprciated :-)

cheers

andrew



Attachment: plperl-array.patch
Description: text/x-patch (5.3 KB)

Responses

pgsql-patches by date

Next:From: Dave PageDate: 2005-06-20 12:07:17
Subject: Default database patch
Previous:From: Eugen NedelcuDate: 2005-06-20 07:11:14
Subject: Thousands commas in psql

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