Re: [HACKERS] [GENERAL] workaround for lack of REPLACE() function

2002-08-12 Thread Joe Conway
Tatsuo Ishii wrote: >>Now a new function similar to toast_raw_datum_size(), maybe >>toast_raw_datum_strlen() could be used to get the original string >>length, whether MB or not, without needing to retrieve and decompress >>the entire datum. >> >>I understand we would either: have to steal anot

Re: [HACKERS] [GENERAL] workaround for lack of REPLACE() function

2002-08-11 Thread Tatsuo Ishii
> Now, in the multibyte case, again in textlen(), I see: > >/* optimization for single byte encoding */ >if (pg_database_encoding_max_length() <= 1) > PG_RETURN_INT32(VARSIZE(t) - VARHDRSZ); > >PG_RETURN_INT32( >pg_mbstrlen_with_len(VARDATA(t), VARSIZE(t) - VARHDRSZ)); >

Re: [HACKERS] [GENERAL] workaround for lack of REPLACE() function

2002-08-11 Thread Joe Conway
Tatsuo Ishii wrote: >>Any objection if I rework this function to meet SQL92 and fix the bug? > I don't object. One more question on this: how can I generate some characters with > 1 encoding length? I need a way to test the work I'm doing, and I'm not quite sure how to test it. Just making a

Re: [HACKERS] [GENERAL] workaround for lack of REPLACE() function

2002-08-11 Thread Joe Conway
Tatsuo Ishii wrote: >>Any objection if I rework this function to meet SQL92 and fix the bug? > I've started working on text_substr() as described in this thread (which is hopefully prep work for the replace() function that started the thread). I haven't really looked at toast or multibyte clo

Re: [HACKERS] [GENERAL] workaround for lack of REPLACE() function

2002-08-09 Thread Tatsuo Ishii
> Any objection if I rework this function to meet SQL92 and fix the bug? I don't object. > Or is the SQL92 part not desirable because it breaks backward > compatability? I don't think so. > In any case, can the #ifdef MULTIBYTE's be removed now in favor of a > test for encoding max length?

Re: [HACKERS] [GENERAL] workaround for lack of REPLACE() function

2002-08-09 Thread Joe Conway
Joe Conway wrote: > more work than I had time for when I wrote the current replace(). But as > I said, if there is support for getting this into the backend, I'll add > it to my todo list: > > - Create new backend function replace() > - Either create new backend functions, or merge into existin

Re: [HACKERS] [GENERAL] workaround for lack of REPLACE() function

2002-07-12 Thread Joe Conway
Thomas Lockhart wrote: > (crossposted to -hackers, should follow up on that list) > OK, this is in the "can't do it what we have" category. Should we have > it accept a regular expression rather than a simple string? In either > case it should probably go into the main distro. Except that I se

Re: [HACKERS] [GENERAL] workaround for lack of REPLACE() function

2002-07-12 Thread Thomas Lockhart
(crossposted to -hackers, should follow up on that list) > Well, OVERLAY is defined as: > overlay(string placing string from integer [for integer]) > and replace() is defined (by me at least) as: > replace(inputstring, old-substr, new-substr) OK. > OVERLAY requires that I know the "fr