Re: pl/python custom datatype parsers

From: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
To: Jan Urbański <wulczer(at)wulczer(dot)org>
Cc: Postgres - Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pl/python custom datatype parsers
Date: 2011-02-04 16:19:05
Message-ID: AANLkTikx5B0CO7nytE+cghoQej3w2V1pNPzX8k-C-o8M@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2011/1/28 Jan Urbański <wulczer(at)wulczer(dot)org>:
> On 23/12/10 15:15, Jan Urbański wrote:
>> Here's a patch implementing custom parsers for data types 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.
>
> Updated to master.

I reviewed this for some time today.

The patch applies with hunks, compiles and tests are passed, though it
looks like not having additional test along with it.

- in hstore_plpython.c,
PLyParsers parsers = {
.in = hstore_to_dict,
.out = dict_to_hstore
};
I'm not sure if this coding style is used anywhere in the core.
Isn't this the C99 style?

- You need define custom variable class to use this feature.
plpython.hstore = 'public.hstore'. I wonder why it's called
plpython[u].hstore = 'public.hstore' (with 'u') because the language
is called "plpythonu".

- typo in plpython.h,
Types for parsres functions that ...

- I tried the sample you mention upthread,
regression=# select pick_one('a=>3, b=>4', 'b');
ERROR: TypeError: string indices must be integers
CONTEXT: PL/Python function "pick_one"

My python is 2.4.3 again.

That's it for now. It is an exciting feature and plpython will be the
first language to think of when you're building "object database" if
this feature is in. The design here will affect following pl/perl and
other so it is important enough to discuss.

Regards,

--
Hitoshi Harada

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hitoshi Harada 2011-02-04 16:26:58 Re: Add ENCODING option to COPY
Previous Message Markus Wanner 2011-02-04 16:16:52 Re: Problem with postgresql database connection in combination with HUAWEI data modem