bug in substring???

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: bug in substring???
Date: 2004-02-06 21:21:43
Message-ID: Pine.LNX.4.33.0402061419460.6661-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm using substring. Since I'm a coder more than a database guy, I
expected this:

select substring('abcdefgh',0,4);

would give me

abcd

but it gives me a left aligned 'abc'

select substring('abcdefgh',1,4);

works fine.

select substring('abcdefgh',-4,4);

gives me nothing. Shouldn't a negative offset, or even 0 offset result in
an error or something here? Or is there a special meaning to a negative
offset I'm not getting?

Just wondering.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message markw 2004-02-06 21:26:39 Re: Proposed Query Planner TODO items
Previous Message Tom Lane 2004-02-06 21:08:15 Re: Proposed Query Planner TODO items