Re: Oracle-compatible lpad/rpad behavior

From: Andrew Nosenko <awn(at)bcs(dot)zp(dot)ua>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Oracle-compatible lpad/rpad behavior
Date: 2000-12-08 07:33:46
Message-ID: 20001208093346.A1745@bcs.zp.ua
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Jonathan Ellis wrote:
: > 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)

Returns not empty string but NULL:

SQL> select nvl(lpad('abcd', -1, 'foobar'), 'Null') from dual;

NVL(
----
Null

--
Andrew W. Nosenko (awn(at)bcs(dot)zp(dot)ua)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Juriy Goloveshkin 2000-12-08 07:38:33 ilike and --enable-multibyte=KOI8
Previous Message GH 2000-12-08 05:23:04 Postgres demographics?

Browse pgsql-hackers by date

  From Date Subject
Next Message Horst Herb 2000-12-08 08:06:25 RFC: CRC datatype
Previous Message Tom Lane 2000-12-08 07:31:05 Re: Re: COPY BINARY file format proposal