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

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>, pgsql-patches(at)postgresql(dot)org, lockhart(at)fourpalms(dot)org
Subject: Re: [HACKERS] [GENERAL] workaround for lack of REPLACE() function
Date: 2002-08-14 18:09:41
Message-ID: 3D5A9CE5.7020508@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-patches

Tom Lane wrote:
> Joe Conway <mail(at)joeconway(dot)com> writes:
>
>>The only remaining problem is that this causes opr_sanity to fail based
>>on this query: ...
>>This fails because I implemented text_substr() and bytea_substr() to
>>take either 2 or 3 args. This was necessary for SQL92 spec compliance.
>
>
> Rather than loosening the opr_sanity test, I'd suggest setting this
> up as two separate builtin functions. They can call a common
> implementation routine if you like. But a runtime test on the number
> of arguments doesn't offer any attractive improvement.

I took Tom's advice and added wrapper functions around text_substr() and
bytea_substr() to cover the 2 argument case.

I also added tests to strings.sql to cover substr() on toasted columns
of both text and bytea.

If there are no objections, please apply.

Thanks,

Joe

Attachment Content-Type Size
substr.2002.08.14.1.patch text/plain 22.3 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2002-08-14 18:12:05 Re: Transaction Exception Question
Previous Message Bruce Momjian 2002-08-14 18:09:20 Re: cvs postgresql current lacks 'ksqo' ? odbc/pgadmin does

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-08-14 18:16:41 Re: pg_dump output portability
Previous Message Rod Taylor 2002-08-14 18:07:38 Re: pg_dump output portability

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2002-08-14 18:15:46 Re: Documentation update (pg_get_fkeydef, current_database)
Previous Message Bruce Momjian 2002-08-14 17:58:08 Re: Foreign key in pg_dump / psql