2011/2/7 Jan Urbański <wulc...@wulczer.org>:
> On 04/02/11 16:26, Hitoshi Harada wrote:
>> 2011/1/28 Jan Urbański <wulc...@wulczer.org>:
>>> On 27/01/11 00:41, Jan Urbański wrote:
>>>> I'm also attaching an updated version that should apply on top of my
>>>> github refactor branch (or incrementally over the new set of refactor
>>>> patches that I will post shortly to the refactor thread).
>>>
>>> Attached is a patch for master, as the refactorings have already been
>>> merged.
>>
>> Sorry, but could you update your patch? Patching it against HEAD today
>> makes rej.
>
> Sure, here's an updated patch.

Thanks,

I revisited the problem of typeinfo cache, and I guess this is not
what you want;

db1=# create function func1(t text) returns record as $$ return
{'v1':1,'v2':2,t:3} $$ language plpythonu;
CREATE FUNCTION
db1=# select * from func1('v3') as (v3 int, v2 int, v1 int);
 v3 | v2 | v1
----+----+----
  3 |  2 |  1
(1 row)

db1=# select * from func1('v3') as (v1 int, v2 int, v3 int);
 v1 | v2 | v3
----+----+----
  3 |  2 |  1
(1 row)

db1=# select * from func1('v4') as (v1 int, v2 int, v3 int);
ERROR:  key "v3" not found in mapping
HINT:  To return null in a column, add the value None to the mapping
with the key named after the column.
CONTEXT:  while creating return value
PL/Python function "func1"
db1=# select * from func1('v4') as (v1 int, v2 int, v4 int);
ERROR:  key "v3" not found in mapping
HINT:  To return null in a column, add the value None to the mapping
with the key named after the column.
CONTEXT:  while creating return value
PL/Python function "func1"

The PL/pgSQL case you pointed earlier is consistent because it fetches
the values positionally. The column name is only an on-demand
labeling. However, for mapping dict of python into the table row
should always map it by key. At least the function author (including
me :P) expects it.

Regards,


-- 
Hitoshi Harada

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to