PL/Python char(n) problem

Started by Nestor A. Diazalmost 23 years ago5 messagesbugs
Jump to latest
#1Nestor A. Diaz
nestor@tiendalinux.com

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@tiendalinux.com http://soporte.tiendalinux.com

#2Noname
cookfire@softhome.net
In reply to: Nestor A. Diaz (#1)
PL/PGSQL stat failed on file '$libdir/plpgsql'

Hi,

Since Linux Mandrake 9.1 came out, I have this problem with pl/pgsql:

[root@localhost jo]# su postgres
bash-2.05b$ createdb test
CREATE DATABASE
bash-2.05b$ createlang plpgsql test
ERROR: stat failed on file '$libdir/plpgsql': No such file or directory
createlang: language installation failed
bash-2.05b$
bash-2.05b$

Does anybody know what is going on?

Following a hint found with google:

bash-2.05b$ pg_config --pkglibdir
bash: pg_config: command not found
bash-2.05b$ exit
exit
[root@localhost jo]# pg_config --pkglibdir
bash: pg_config: command not found

[root@localhost jo]# echo $libdir

[root@localhost jo]#

What should this variable contain?

[root@localhost jo]# cd /usr/local
[root@localhost local]# ls
bin/ doc/ etc/ games/ include/ lib/ libexec/ pgsql/ sbin/ share/
src/ vortaro/
[root@localhost local]# cd pgsql
[root@localhost pgsql]# ls
bin/ doc/ include/ lib/ man/ share/
[root@localhost pgsql]# cd lib
[root@localhost lib]# ls
ascii_and_mic.so* latin2_and_win1250.so* libpq.a
utf8_and_big5.so* utf8_and_gb18030.so* utf8_and_tcvn.so*
cyrillic_and_mic.so* latin_and_mic.so* libpq.so@
utf8_and_cyrillic.so* utf8_and_gbk.so* utf8_and_uhc.so*
euc_cn_and_mic.so* libecpg.a libpq.so.3@
utf8_and_euc_cn.so* utf8_and_iso8859_1.so* utf8_and_win1250.so*
euc_jp_and_sjis.so* libecpg.so@ libpq.so.3.0*
utf8_and_euc_jp.so* utf8_and_iso8859.so* utf8_and_win1256.so*
euc_kr_and_mic.so* libecpg.so.3@ plpgsql.so*
utf8_and_euc_kr.so* utf8_and_johab.so* utf8_and_win874.so*
euc_tw_and_big5.so* libecpg.so.3.4.1* utf8_and_ascii.so*
utf8_and_euc_tw.so* utf8_and_sjis.so*
[root@localhost lib]#

Is everything present?

[root@localhost lib]# su postgres
bash-2.05b$ echo $libdir

bash-2.05b$ export libdir=/usr/local/pgsql/lib
bash-2.05b$ echo $libdir
/usr/local/pgsql/lib
bash-2.05b$ createlang plpgsql test
ERROR: stat failed on file '$libdir/plpgsql': No such file or directory
createlang: language installation failed
bash-2.05b$

I'm stuck, hope anybody can help me out

Many thanks,

Jo

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Noname (#2)
Re: [INTERFACES] PL/PGSQL stat failed on file '$libdir/plpgsql'

cookfire@softhome.net writes:

bash-2.05b$ pg_config --pkglibdir
bash: pg_config: command not found

If you can't find pg_config you had better figure out why not. Either
your PATH setting doesn't include the directory where Postgres
executables were installed, or you have a very old or broken Postgres.

regards, tom lane

#4Noname
cookfire@softhome.net
In reply to: Tom Lane (#3)
Re: PL/PGSQL stat failed on file '$libdir/plpgsql'

After installing all these packages, it seems to work now:

[root@localhost win_e]# urpme postgres
The following packages contain postgres: postgresql-7.3.2-5mdk
postgresql-tcl-7.3.2-5mdk postgresql-test-7.3.2-5mdk
postgresql-docs-7.3.2-5mdk postgresql-python-7.3.2-5mdk
postgresql-devel-7.3.2-5mdk postgresql-server-7.3.2-5mdk
postgresql-pl-7.3.2-5mdk postgresql-contrib-7.3.2-5mdk

I am convinced I had already tried that. With onlyh postgresql and
postgresql-server it doesn't work.

Many thanks for your help!

Jo

Tom Lane writes:

cookfire@softhome.net writes:

bash-2.05b$ pg_config --pkglibdir
bash: pg_config: command not found

If you can't find pg_config you had better figure out why not. Either
your PATH setting doesn't include the directory where Postgres
executables were installed, or you have a very old or broken Postgres.

regards, tom lane

Member of Linux MandrakeClub
http://www.mandrakeclub.com

#5Chris Gamache
cgg007@yahoo.com
In reply to: Noname (#4)
PgAdmin II 1.6.0 Error Handler (GUI Annoyance)

I thought this was just a beta-testing feature and would work its way out in
production. That's why I didn't say anything until now... :)

There is an "Exit" Button in the Error Handler that I CONSTANTLY hit by
mistake. Can this be removed or disabled? I'm sure someone wants to exit the
whole application after one error, but it drives me crazy to have to reconnect
to the database after an error when I hit the wrong button. I want to see the
error every time it is raised, but I don't want to exit.

CG

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com