On Wed, Mar 4, 2009 at 11:21 AM, tushar <tushar...@gmail.com> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Devan Goodwin wrote:
> > Suspect we might have something in our schema that doesn't work on 8.3,
> > doing some testing on fedora and hit this:
> >
> > psql:tables/rhn_contact_groups.sql:45: ERROR:  operator does not exist:
> > character = integer HINT:  No operator matches the given name and
> > argument type(s). You might need to add explicit type casts.
> >
> > This is with: postgresql-server-8.3.6-1.fc10.i386
> >
> > Whereas the sql loads fine on postgresql-server-8.1.11-1.el5_1.1.
> >
> > Probably not a huge deal but it'll probably surface at some point. :) I
> > can't even tell what it's complaining about... anybody know?
> >
> > Devan
> >
>
> I verified against PG version 8.1,8.2, it is working fine , for example
> take this table :-
> create table test(n char(1) not null check(n in (0,1))); :-by default it is
> doing implicitly typecasting ,whereas on PG8.3 we need to do it explicitly
> typecasting
> like this :- create table test(n char(9) not null check(n in
> (0::bpchar,1::bpchar))); it will work .
>
>
Yeah, PG 8.3 removed some implicit typecast functions, and implicit casting
of character data to numbers is one of them.

In your case, it is complaining about it's inability to find a comparison
operator = to compare character data to integer data. That's the pitfall of
having same data in two table columns, but with different datatypes.

For eg. one table has int columns  A, and other table has varchar column B,
but the data populated by application in both is supposed to be of type
integer (cases like foreign keys implemented in app);

create table t ( a int primary key );
create table t1( a char(10) references t(a) ); -- will work in < 8.3 but not
in >= 8.3

insert into t values( 123 );
insert into t1 values( '123' );

select * from t, t1 where t.a = t1.a; -- will work in PG < 8.3 but not since
8.3 (if you dont use the FKey in create table)

Solution is to either change the datatype of one of the columns to match the
other one, or to use explicit casting.

HTH,
Best regards,
-- 
gurjeet[.sin...@enterprisedb.com
EnterpriseDB      http://www.enterprisedb.com

singh.gurj...@{ gmail | hotmail | indiatimes | yahoo }.com
_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to