Re: View - Join based on dis-similar data types

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "speakeasy" <nospam_artd(at)speakeasy(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: View - Join based on dis-similar data types
Date: 2003-03-12 22:32:39
Message-ID: 29847.1047508359@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"speakeasy" <nospam_artd(at)speakeasy(dot)net> writes:
> I have a field defined as a character(50) data type, and the same field
> stored in a transition table as a text type.

> The view itself work based on the join, however sub-queries against the view
> on that field do not return any data.

You probably need to rtrim() the CHAR field so that the trailing blanks
in it don't foul up the comparison to the TEXT field. Trailing blanks
are considered insignificant in CHAR comparisons ... but not in TEXT
comparisons. So,

WHERE rtrim(charfield) = textfield

should work.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Steve Crawford 2003-03-12 22:39:04 Re: "hide" values in a column
Previous Message Jordan S. Jones 2003-03-12 22:01:12 Retrieving Definition for Composite Type