Thread: CONVERT function is seriously broken

CONVERT function is seriously broken

From
Tom Lane
Date:
I have just noticed that the implementation ofCONVERT(text USING encoding_name)
tries to do database access during the grammar phase, viz it looks
up the encoding_name in pg_conversion and replaces it with an OID.

This is not workable; consider the situation where we are in an
already-aborted transaction.  Using a pg_conversion OID in stored rules
isn't very acceptable either.

Unfortunately, I don't see any way offhand to fix this without an
initdb :-(.
        regards, tom lane


Re: CONVERT function is seriously broken

From
Bruce Momjian
Date:
Tom Lane wrote:
> I have just noticed that the implementation of
>     CONVERT(text USING encoding_name)
> tries to do database access during the grammar phase, viz it looks
> up the encoding_name in pg_conversion and replaces it with an OID.
> 
> This is not workable; consider the situation where we are in an
> already-aborted transaction.  Using a pg_conversion OID in stored rules
> isn't very acceptable either.
> 
> Unfortunately, I don't see any way offhand to fix this without an
> initdb :-(.

Ooch, that hurts.  How bad would it be if it was broken in 7.3?

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: CONVERT function is seriously broken

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Tom Lane wrote:
>> Unfortunately, I don't see any way offhand to fix this without an
>> initdb :-(.

> Ooch, that hurts.  How bad would it be if it was broken in 7.3?

We could dike out the feature:

convert_list:           a_expr USING any_name               {                   elog(ERROR, "CONVERT(... USING ...) is
notimplemented");               }
 

Short of that, I think we need an initdb to change the function
signature for the convert() function.  It needs to take a (suitably
quoted) text parameter, not an OID.

Since we forced initdb only a week ago with beta3, I don't think there
is really a strong argument against doing it again.  But probably Marc
will say that we need a beta4 at this point, instead of going for RC1...
        regards, tom lane


Re: CONVERT function is seriously broken

From
Bruce Momjian
Date:
Tom Lane wrote:
> We could dike out the feature:
> 
> convert_list:
>             a_expr USING any_name
>                 {
>                     elog(ERROR, "CONVERT(... USING ...) is not implemented");
>                 }
> 
> Short of that, I think we need an initdb to change the function
> signature for the convert() function.  It needs to take a (suitably
> quoted) text parameter, not an OID.
> 
> Since we forced initdb only a week ago with beta3, I don't think there
> is really a strong argument against doing it again.  But probably Marc
> will say that we need a beta4 at this point, instead of going for RC1...

He certainly will.  We can shoot out beta4 and make it sort.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: CONVERT function is seriously broken

From
"Marc G. Fournier"
Date:
On Sat, 2 Nov 2002, Tom Lane wrote:

> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Tom Lane wrote:
> >> Unfortunately, I don't see any way offhand to fix this without an
> >> initdb :-(.
>
> > Ooch, that hurts.  How bad would it be if it was broken in 7.3?
>
> We could dike out the feature:
>
> convert_list:
>             a_expr USING any_name
>                 {
>                     elog(ERROR, "CONVERT(... USING ...) is not implemented");
>                 }
>
> Short of that, I think we need an initdb to change the function
> signature for the convert() function.  It needs to take a (suitably
> quoted) text parameter, not an OID.
>
> Since we forced initdb only a week ago with beta3, I don't think there
> is really a strong argument against doing it again.  But probably Marc
> will say that we need a beta4 at this point, instead of going for RC1...

Most definitely ... but beta3 was nice and short, and no reason why beta4
can't be as well ...




Re: CONVERT function is seriously broken

From
Tatsuo Ishii
Date:
> I have just noticed that the implementation of
>     CONVERT(text USING encoding_name)
> tries to do database access during the grammar phase, viz it looks
> up the encoding_name in pg_conversion and replaces it with an OID.
> 
> This is not workable; consider the situation where we are in an
> already-aborted transaction.  Using a pg_conversion OID in stored rules
> isn't very acceptable either.
> 
> Unfortunately, I don't see any way offhand to fix this without an
> initdb :-(.

Sorry for the trouble and thanks for the fix.
--
Tatsuo Ishii