On 02/06/10 09:46, Takahiro Itagaki wrote:
>
> Heikki Linnakangas<heikki.linnakangas@enterprisedb.com> wrote:
>
>> Hmm, seems that dblink should call truncate_identifier() for the
>> truncation, to be consistent with truncation of table names etc.
>
> Hmmm, we need the same routine with truncate_identifier(), but we hard
> to use the function because it modifies the input buffer directly.
> Since all of the name strings in dblink is const char *, I added
> a bit modified version of the function as truncate_identifier_copy()
> in the attached v2 patch.
Well, looking at the callers, most if not all of them seem to actually
pass a palloc'd copy, allocated by text_to_cstring().
Should we throw a NOTICE like vanilla truncate_identifier() does?
I feel it would be better to just call truncate_identifier() than roll
your own. Assuming we want the same semantics in dblink, we'll otherwise
have to remember to update truncate_identifier_copy() with any changes
to truncate_identifier().
-- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com