Re: Bizarre problem: Python stored procedure using protocol buffers not working

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Yang Zhang <yanghatespam(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Bizarre problem: Python stored procedure using protocol buffers not working
Date: 2010-05-16 05:20:28
Message-ID: 1273987228.5043.4.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On lör, 2010-05-15 at 15:40 -0700, Yang Zhang wrote:
> yang=# select * from qapb;
> id | pb
> ----+------------------------------------------------------------------------
> 0 | \012\006hello?\020\000\030\000 \000*\014\012\006hello!\020\000\030\000
> (1 row)
>
> yang=# create or replace function foo() returns text as $$
> import sys, plpy
> if '/home/yang/work/pod/' not in sys.path:
> sys.path.append('/home/yang/work/pod/')
> from my_pb2 import * # this is a protobuf generated module
> rv = plpy.execute('select * from qapb')
> q = Q()
> q.ParseFromString(str(rv[0]['pb']))
> return str(q);
> $$ language plpythonu;
> CREATE FUNCTION
> yang=# select foo();
> foo
> -----
>
> (1 row)

You have null bytes in the data value, which is not supported very well
in PL/Python. Try the 9.0 beta version; it should be fixed there.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Yang Zhang 2010-05-16 05:50:32 Re: Bizarre problem: Python stored procedure using protocol buffers not working
Previous Message Tom Duffey 2010-05-16 01:05:16 Re: Query memory usage