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

Re: plpython integer types

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Emiliano Amilcarelli <amiemi(at)tin(dot)it>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: plpython integer types
Date: 2005-11-18 05:06:18
Message-ID: 20051118050618.GA70723@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-novice
On Thu, Nov 17, 2005 at 03:46:46PM +0100, Emiliano Amilcarelli wrote:
> No, it doesn,'t work if i use int4

int4 works for me in PostgreSQL 8.1.0 and 8.0.4:

CREATE TABLE foo (
    i  integer,
    f  float8,
    n  numeric,
    t  text,
    d  date
);

CREATE FUNCTION populate() RETURNS boolean AS $$
query = 'INSERT INTO foo (i, f, n, t, d) VALUES ($1, $2, $3, $4, $5)'
types = ('int4', 'float8', 'numeric', 'text', 'date')
plan = plpy.prepare(query, types)
plpy.execute(plan, (1, 2.3, 4.56, 'test', '2005-11-17'))
return True
$$ LANGUAGE plpythonu VOLATILE;

SELECT populate();
 populate 
----------
 t
(1 row)

SELECT * FROM foo;
 i |  f  |  n   |  t   |     d      
---+-----+------+------+------------
 1 | 2.3 | 4.56 | test | 2005-11-17
(1 row)

-- 
Michael Fuhr

In response to

pgsql-novice by date

Next:From: William YuDate: 2005-11-18 13:08:13
Subject: Re: Application using PostgreSQL (off topic,
Previous:From: Bernardo LópezDate: 2005-11-18 04:45:32
Subject: Re: org.postgresql.Driver

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