On 11/18/11 10:27 AM, Ed Leafe wrote:
> On Nov 18, 2011, at 12:18 PM, Paul McNett wrote:
>
>> Ooh, here's an inconsistency, since in Python "abc   " != "abc". Since the 
>> database
>> does the padding/unpadding, the char values should come to the Dabo layer 
>> unpadded.
>
>       If you want that behavior, make it varchar, not char.

Yes, that's what I'm doing now.

>       What if you stored "abc   " in a char(20) field? What would be a 
> consistent value to receive back?

The inconconsistency that I'm presently talking about is that when comparing 
fields 
in postgres, as with "where <field_name> = <other_field_name>", the padded 
characters 
are insignificant. However, when comparing the strings in Python the padded 
chars are 
significant.

Since postgres turns "abc" into "abc    " when updating, and since postgres 
strips 
the padded spaces in comparisons, it seems to follow that when psycopg2 fetches 
the 
data from postgres, it should strip out the trailing spaces in char fields so 
that 
python comparisons of the data don't take into account the padded spaces.

Paul

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to