Re: Postgresql Text field / Visual FoxPro Memo and ODBC

From: Paul Tillotson <pntil(at)shentel(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Postgresql Text field / Visual FoxPro Memo and ODBC
Date: 2005-01-13 03:01:16
Message-ID: 41E5E47C.50005@shentel.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


>>Ahh, ok. Misunderstood what your method was.
>>
>>Is there a setting in your ODBC driver for memo as text or something
>>like that? It's been a while since I played with pgsql from a windows /
>>odbc box, so I am a bit rusty here. It's just a wild guess.
>>
>>
>
>On my Windows box the Postgresql ODBC driver is set with TEXT AS
>LongVarChar, with a maximum length of 8190. FoxPro then turns the
>LongVarChar into a Memo.
>
>Margaret Gillon, IS Dept., Chromalloy Los Angeles, ext. 297
>
>
>
Margaret,

I haven't tried using text, but I came across a very similar problem
when using VARCHAR(n) columns with foxpro:

Since foxpro supports only CHAR (not VARCHAR), then if you have a table
like this:

create table foo (t varchar(6));
insert into foo (t) values ('aaa');

And, in foxpro, you do this to an updateable view of the table:
replace t with 'bbbbbbb'

Then the SQL that foxpro actually generates looks like this:
UPDATE foo SET t = 'bbbbbbb' WHERE t = 'aaa ';

Notice the WHERE clause says t = 'aaa<space><space><space>'; Trailing
whitespace is significant for varchar columns, and so the update hits no
rows.

Now, if foxpro truly thinks that your text columns are of type MEMO then
I believe it would generate the correct SQL; however, if you have your
ODBC driver set to turn text into VARCHAR(n) columns, then I believe
you're being bit by the same bug that I was: foxpro is probably padding
your value with 8000 or so blanks because it thinks your text column is
varchar(8192).

How do you figure this out? Use ethereal.

http://www.ethereal.com/

Paul Tillotson

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John DeSoi 2005-01-13 05:41:25 pgEdit 1.0b6
Previous Message Jeff Davis 2005-01-13 02:12:35 Re: index on user defined type