PL/Python char(n) problem

From: "Nestor A(dot) Diaz L(dot)" <nestor(at)tiendalinux(dot)com>
To: jacobs(at)penguin(dot)theopalgroup(dot)com
Cc: jacobs(at)NO-SPAM(dot)penguin(dot)theopalgroup(dot)com, pgsql-interfaces(at)postgresql(dot)org, pgsql-bugs(at)postgresql(dot)org
Subject: PL/Python char(n) problem
Date: 2003-07-06 03:08:39
Message-ID: Pine.LNX.4.21.0307052200230.11502-100000@asterix.intranet.tiendalinux.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs 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 Timestamp NOT 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(at)tiendalinux(dot)com http://soporte.tiendalinux.com

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Markus Bertheau 2003-07-06 10:38:12 slow pasting in psql in UTF-8 locale
Previous Message Tom Lane 2003-07-06 02:06:02 Re: problems...

Browse pgsql-interfaces by date

  From Date Subject
Next Message Christoph Haller 2003-07-07 09:27:00 Re: Need help on bytea usage
Previous Message Nicolás Alvarez 2003-07-04 22:39:47 install postgresql 7.2 with CXX on sco openserver 5.0.5