Re: Bytea as C string in pg_convert?

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Brendan Jurd <direvus(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Bytea as C string in pg_convert?
Date: 2007-09-24 15:07:17
Message-ID: 46F7D2A5.9090005@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>
>> We can and possibly should change the GETARG call, but the varlena types
>> are structurally equivalent, so it's not a mortal sin being committed here.
>>
>
> We *definitely* should change it --- the reason for having all those
> variant macros in the first place was to help document the argument
> types of V1 functions. It's too bad the compiler doesn't warn about
> the type mismatch here ...
>
>
>

I have changed it. The thing is, though, that this function not only
performs the convert() function but acts as the engine for convert_to()
and convert_from(). Those functions do some silent transformations, in
one case passing a text Datum as the first argument and in the other
case the returning the result as text. If there's a better way to do
this I'll be happy to learn, but it seems to me it would involve some
duplication - I tried to avoid that where possible.

Maybe I should just put a note in the code saying what we're doing, and
why it's OK.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-09-24 15:17:11 Re: Bytea as C string in pg_convert?
Previous Message Tom Lane 2007-09-24 14:32:19 Re: Bytea as C string in pg_convert?