Re: This works in 7.2.1, not in 7.3.2

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: This works in 7.2.1, not in 7.3.2
Дата
Msg-id 20030711164103.D64053-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на This works in 7.2.1, not in 7.3.2  ("Frank Millman" <frank@chagford.com>)
Список 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 по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: corrupt data
Следующее
От: "Chad N. Tindel"
Дата:
Сообщение: Am I using the SERIAL type properly?