Re: This works in 7.2.1, not in 7.3.2 - Mailing list pgsql-general

From Stephan Szabo
Subject Re: This works in 7.2.1, not in 7.3.2
Date
Msg-id 20030711164103.D64053-100000@megazone23.bigpanda.com
Whole thread Raw
In response to This works in 7.2.1, not in 7.3.2  ("Frank Millman" <frank@chagford.com>)
List 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.


pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: corrupt data
Next
From: "Chad N. Tindel"
Date:
Subject: Am I using the SERIAL type properly?