[Oledb-dev] [patch] parameterized varchar values containing >64 characters are not accepted by PostgreSQL

Shachar Shemesh psql at shemesh.biz
Wed May 3 11:32:51 UTC 2006


Victor Snezhko wrote:

>Shachar Shemesh <shachar at lingnu.com> writes:
>  
>
>>Well, knowing how the postgresql internal type system works, it is
>>better to pass strings as "text" rather than "varchar".
>>    
>>
>
>Hmm, could you explain why? I may be wrong here, but as far as I
>understood from src/backend/utils/adt/varchar.c, varchar internally
>enforces length checks (if length is supplied), which is generally a
>good thing. Not sure about text.
>  
>
text is not length limited, which is a plus. The limits are unknown to
the client anyways, and there is no need to enforce them, as any limit
will be enforced during the conversion from text to varchar.

Looking at it again, the answer is that it really doesn't matter. I
thought that "text" would provide better casts for other types (i.e. -
sending the string '11-sep-2001' to a "date" field), but it seems there
is no difference.

I guess it's just that "text" is the more general case.

>>I think I'll do the following:
>>Right now we'll leave it as is (using timestamptz), hoping that if
>>someone complains we can tell them to either switch their DB to
>>"timestamptz", or to make sure that the server and clients both use the
>>same timezone.
>>    
>>
>
>Yes, let it be this way.
>BTW, I haven't yet written binary conversion functions, so timestamps
>aren't passed anyway.
>  
>
>>Long term, we'll try to add a caching mechanism for this lookup. 
>>    
>>
>
>Hmm... I understood everything until this moment. Lookup?
>  
>
Oops, my mistake. m_ole_oid_map is already such a lookup. We just need
to have "CPgSession::PgConnectDB" override s_types_oids decision
regarding timestamp if the proper connection string is given.

       Shachar



More information about the Oledb-devel mailing list