Re: [HACKERS] AW: Oracle-compatible lpad/rpad behavior

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] AW: Oracle-compatible lpad/rpad behavior
Date: 2000-12-11 15:32:58
Message-ID: 7236.976548778@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at> writes:
>> Also, what happens if the specified length is less than zero? Error,
>> or is it treated as zero?

> Returns NULL in both if length <= 0. I would see the < 0 case as proper,
> but the == 0 case sure looks weird to me.

Since Oracle fails to distinguish NULL from empty string, it's hard to
tell what they have in mind here. I've implemented it as empty-string
result for length <= 0. You could possibly make a case for empty string
at length = 0 and NULL for length < 0, but I'm not sure it's worth the
trouble...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tomas Berndtsson 2000-12-11 15:37:14 Re: Simple Question: Case sensitivity
Previous Message Tom Lane 2000-12-11 15:30:07 Re: Regular expression question

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-12-11 16:57:49 Is VACUUM still crash-safe?
Previous Message Tom Lane 2000-12-11 15:30:07 Re: Regular expression question