Re: Bytea as C string in pg_convert? - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Bytea as C string in pg_convert?
Date
Msg-id 46F7D2A5.9090005@dunslane.net
Whole thread Raw
In response to Re: Bytea as C string in pg_convert?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Bytea as C string in pg_convert?
List pgsql-hackers

Tom Lane wrote:
> Andrew Dunstan <andrew@dunslane.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bytea as C string in pg_convert?
Next
From: Tom Lane
Date:
Subject: Re: Bytea as C string in pg_convert?