BUG #10972: string_agg function incorrectly concatenating varying delimiter
От | jeff@goaldriven.com |
---|---|
Тема | BUG #10972: string_agg function incorrectly concatenating varying delimiter |
Дата | |
Msg-id | 20140716001632.2502.98836@wrigleys.postgresql.org обсуждение исходный текст |
Ответы |
Re: BUG #10972: string_agg function incorrectly concatenating varying delimiter
Re: BUG #10972: string_agg function incorrectly concatenating varying delimiter |
Список | pgsql-bugs |
The following bug has been logged on the website: Bug reference: 10972 Logged by: Jeff Fischer Email address: jeff@goaldriven.com PostgreSQL version: 9.3.1 Operating system: CentOS Description: Running the query below will show how the delimiter for the current row is actually the subsequent rows delimiter. The sequence goes like this: TestBlah 1 ITTest 2 testfail 3 Yet, the concatened output is this: "testblah 2 ITtest 3 testfail" You can see that the delimiter for the current row is actually getting the subsequent rows delimiter. It's as though the string concat moves to the next row prior to concatenting the delimiter, which is likely the cause of this bug. SELECT string_agg( Field1, ' ' || RowIndex::text || ' ' ORDER BY RowIndex) as VeryLongConcatenatedResultsFieldName FROM ( SELECT 'testblah' as Field1, 1 as RowIndex UNION SELECT 'ITtest' as Field1, 2 as RowIndex UNION SELECT 'testfail' as Field1, 3 as RowIndex ) t;
В списке pgsql-bugs по дате отправления: