Re: View - Join based on dis-similar data types - Mailing list pgsql-sql

From Tom Lane
Subject Re: View - Join based on dis-similar data types
Date
Msg-id 29847.1047508359@sss.pgh.pa.us
Whole thread Raw
In response to View - Join based on dis-similar data types  ("speakeasy" <nospam_artd@speakeasy.net>)
List pgsql-sql
"speakeasy" <nospam_artd@speakeasy.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


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: extending ORDER BY make query much slower
Next
From: Steve Crawford
Date:
Subject: Re: "hide" values in a column