PQfmod and varchars - Mailing list pgsql-hackers

From Shachar Shemesh
Subject PQfmod and varchars
Date
Msg-id 4268BA34.9070303@shemesh.biz
Whole thread Raw
List pgsql-hackers
Hi list,

I'm trying to find out, from a client, how many characters will fit in a 
varchar field 
(http://pgfoundry.org/tracker/index.php?func=detail&aid=1000286&group_id=1000085&atid=394). 
Problem is that when I do "PQfmod" on a varchar field defined as 
"varchar(20)", PQfmod returns "24".

Now, it's fairly easy for me to subtract 4 from each result I get from 
PQfmod, but I have a suspicion that this "4" is actually "pointer's 
length", which means that I need to detect a 64 bit server and subtract 
8 instead.

1. Is this suspicion correct?
2. If so, how do I detect how much to subtract.
3. If not, what is the meaning of "4"?

Thanks,         Shachar

-- 
Shachar Shemesh
Lingnu Open Source Consulting ltd.
Have you backed up today's work? http://www.lingnu.com/backup.html



pgsql-hackers by date:

Previous
From: Neil Conway
Date:
Subject: slides on the optimizer
Next
From: Andrew - Supernews
Date:
Subject: Re: PQfmod and varchars