Thread: CONVERT function is seriously broken
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
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
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
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
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 ...
> 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