PL/Python char(n) problem - Mailing list pgsql-interfaces

From Nestor A. Diaz L.
Subject PL/Python char(n) problem
Date
Msg-id Pine.LNX.4.21.0307052200230.11502-100000@asterix.intranet.tiendalinux.com
Whole thread Raw
Responses PL/PGSQL stat failed on file '$libdir/plpgsql'
List pgsql-interfaces
Hi, i am new to plpython, and i was making some test with this library,
however i notice there is a problem or but with char data types, i have
for example the following table:

Create table t_visitor
(       id Varchar(20) NOT NULL,       typx char(2) NOT NULL Constraint ck_typx Check (typx IN
('CC','CE','TI')
),       lastname Varchar(100) NOT NULL,       firstname Varchar(100) NOT NULL,       notes Text,       created
TimestampNOT NULL Default 'now',
 
constraint pk_t_visitor primary key (id,typx)
);

and i use the following trigger:

CREATE OR REPLACE FUNCTION f_tiud_t_visitor() RETURNS TRIGGER AS ' plpy.notice (TD[lookup])


' LANGUAGE 'plpython';

DROP TRIGGER tiud_t_visitor ON t_visitor;

CREATE TRIGGER tiud_t_visitor
AFTER INSERT OR UPDATE OR DELETE
ON t_visitor
FOR EACH ROW
EXECUTE PROCEDURE f_tiud_t_visitor();

and when i executed the code:

zivis=> insert into t_visitor (id,typx,lastname,firstname) values
(4,'TI','diaz'
,'nestor');
NOTICE:  ({'id': '4', 'notes': None, 'lastname': 'diaz',
'created': '2003-07-05
22:03:28.81706', 'firstname': 'nestor', 'typx': 0},)
INSERT 66761 1

So, the field 'typx' don't show the value of 'TI', when i change the field
type of 'typx' to varchar it works.

Thanks if you can help me.

Bye.

--
Nestor A. Diaz Lizarazo                   Tel. +57.1.6005490
Ingeniero de Sistemas y Comp.                Cel. +57.3.3102827965
nestor@tiendalinux.com                      http://soporte.tiendalinux.com



pgsql-interfaces by date:

Previous
From: Nicolás Alvarez
Date:
Subject: install postgresql 7.2 with CXX on sco openserver 5.0.5
Next
From: Christoph Haller
Date:
Subject: Re: Need help on bytea usage