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

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Jonathan Ellis <jellis(at)advocast(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Re: Oracle-compatible lpad/rpad behavior
Date: 2000-12-12 19:00:39
Message-ID: 3A3675D7.A80234AF@tm.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Jonathan Ellis wrote:
>
> > I went to fix this and then realized I still don't have an adequate spec
> > of how Oracle defines these functions. It would seem logical, for
> > example, that lpad might truncate on the left instead of the right,
> > ie lpad('abcd', 3, 'whatever') might yield 'bcd' not 'abc'. Would
> > someone check?
>
> SQL> select lpad('abcd', 3, 'foobar') from dual;
>
> LPA
> ---
> abc
>
> > Also, what happens if the specified length is less than zero? Error,
> > or is it treated as zero?
>
> SQL> select ':' || lpad('abcd', -1, 'foobar') || ':' from dual;
>
> ':
> --
> ::
>
> (colons added so it's obvious that it's a zero-length string)

AFAIK Oracle is unable to distinguish NULL and zero-length string ;(

--------------
Hannu

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vince Vielhaber 2000-12-12 19:06:06 Re: manuals
Previous Message Mike Sears 2000-12-12 18:56:43 Starting postgres7.1beta through init

Browse pgsql-hackers by date

  From Date Subject
Next Message Lamar Owen 2000-12-12 19:30:01 Re: RPM changes for 7.1.
Previous Message Randy Jonasz 2000-12-12 18:53:09 Re: RFC C++ Interface