Postgres 6.3.2 varchar <--> int4 conversions

Lists: 범퍼카 토토 PostgreSQL : PostgreSQL 메일 링리스트 : 1999-01-14 이후 PGSQL-BUGS 01:52pgsql-hackers
From: Roland Roberts <roberts(at)panix(dot)com>
To: pgsql-bugs(at)postgreSQL(dot)org, hackers(at)postgreSQL(dot)org
Subject: Postgres 6.3.2 varchar <--> int4 conversions
Date: 1999-01-14 01:52:36
Message-ID: m3iuea1uzf.fsf@ptolemy.rlent.pnet
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: 범퍼카 토토 PostgreSQL : PostgreSQL 메일 링리스트 : 1999-01-14 이후 PGSQL-BUGS 01:52 pgsql-hackers

-----BEGIN PGP SIGNED MESSAGE-----

I recently had a query fail with the following error:

keystone=> select members.id, members.element, slips.sid, slips.problem
keystone-> from slips, members
keystone-> where members.element = slips.sid
keystone-> and members.id = 'quickslips';
ERROR: There is no operator '=' for types 'varchar' and 'int4'
You will either have to retype this query using an explicit cast,
or you will have to define the operator using CREATE OPERATOR

casting the varchar column to int4 works, but if I try to cast the
int4 to varchar I get another error:

keystone=> select members.id, members.element, slips.sid, slips.problem
keystone-> from slips, members
keystone-> where members.element = varchar(slips.sid)
keystone-> and members.id = 'quickslips';
ERROR: parser: parse error at or near "slips"

I would expect that the int4 --> varchar conversion would be the
"safer" one to do. By "safer" I mean that an int4 value should map to
a distinct varchar value whereas all non-numeric varchar values
generate an error in pg_atoi....

roland
- --
PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD Custom Software Solutions
roberts(at)panix(dot)com 101 West 15th St #4NN
rbroberts(at)acm(dot)org New York, NY 10011

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2
Comment: Processed by Mailcrypt 3.4, an Emacs/PGP interface

iQCVAwUBNp1N4uoW38lmvDvNAQG/PAQAr1eU8jG6lsfFACxb732mFA/rnxKkKIED
bn0t3AbAZMMyWe1GajQ5iEXz3ZrZmQGgGS05WMtLyo6HF/Zxvdj235qSJFVsucC3
nQR/knEO+we3/PUCiqKEPPZNkufCxhyFjFEctws1wcp5XDnrO3EiYTBC5vTUXNF1
1nW+k38StyU=
=gWkW
-----END PGP SIGNATURE-----