Re: This works in 7.2.1, not in 7.3.2

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Frank Millman <frank(at)chagford(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: This works in 7.2.1, not in 7.3.2
Date: 2003-07-11 23:58:04
Message-ID: 20030711164103.D64053-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 10 Jul 2003, Frank Millman wrote:

> Hi all
>
> The following works in 7.2.1 -
>
> 1. select count(*) from SysUsersCompanies where UserRowId = 3 ;
> 2. select substring('NY',(select count(*) from SysUsersCompanies where UserRowId = 3)+1,1) ;
>
> The first select returns either 1 or 0
> The second one uses the result in a more complex expression, and returns either 'Y' or 'N'
>
> In 7.3.2, the first select behaves the same, but the second one returns NULL.
>
> Any advice will be appreciated.

It looks like in 7.2 it'd call substring(text, int, int).

In 7.3, I don't think that'd be a possible target due to some of the
implicit casting changes. It appears that substring(text, text, text) was
added which is then the valid choice, but it works differently (see the
docs). As a workaround, if you cast the count expression to an integer
(it's a bigint right now) it should do what you want.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jason Tishler 2003-07-12 00:21:32 Re: PostgreSQL, Cygwin - setting locales
Previous Message Alvaro Herrera 2003-07-11 23:45:20 Re: corrupt data