Re: plpython

From: km <km(at)mrna(dot)tn(dot)nic(dot)in>
To: Jorge Godoy <jgodoy(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: plpython
Date: 2006-10-27 20:06:57
Message-ID: 20061027200657.GA27854@mrna.tn.nic.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Sure. But it depends a lot on what you're willing to do. The docs have the
> details. This one I did just to learn it:
>
> CREATE FUNCTION f_v_fechamento(p_cliente_id integer, p_data date, p_pago boolean, OUT retorno record) RETURNS record
> AS $$
> p_cliente_id = args[0]
> p_data = args[1]
> p_pago = args[2]
>
> w_total = 0
> w_amostra = 0
> w_final_do_mes = plpy.execute("SELECT f_v_final_do_mes(%s::date)" % p_data)
> w_inicio_do_mes = plpy.execute("SELECT f_v_inicio_mes(%s::date)" % p_data)
>
> retorno = dict()
> retorno['w_inicio_do_mes'] = w_inicio_do_mes
> retorno['w_final_do_mes'] = w_final_do_mes
>
> return retorno
> $$
> LANGUAGE plpythonu STABLE;
>
>
> It can be rewritten in a better way but was the handier example I had here
> that had queries and used a bit more of PostgreSQL 8.1 :-)
>
Thanks for that snippet. why is that 'STABLE' at the end of the function ?

i am stuck at createlang for plpythonu! with postgres user
error reads:

$createlang plpythonu template1;
createlang: language installation failed: ERROR: could not load library "/usr/local/pgsql/lib/plpython.so": /usr/local/pgsql/lib/plpython.so: undefined symbol: Py_InitModule4_64

i am on a x86_64 linux box. couldnt comprehend the error.
plpython.so is in /usr/local/pgsql/lib

whats wrong?
regards,
KM

In response to

Responses

  • Re: plpython at 2006-10-27 20:58:30 from Clodoaldo Pinto Neto

Browse pgsql-general by date

  From Date Subject
Next Message Sandro Dentella 2006-10-27 20:11:09 Re: Simple OUTER JOIN doubt
Previous Message Tom Lane 2006-10-27 19:55:35 Re: Simple OUTER JOIN doubt