| От | David Wheeler |
|---|---|
| Тема | Re: Return rows in input array's order? |
| Дата | |
| Msg-id | 5C5270F1-4323-458F-99C2-1D187039EA9C@gmail.com обсуждение |
| Ответ на | Return rows in input array's order? (Dominique Devienne <ddevienne@gmail.com>) |
| Ответы |
Re: Return rows in input array's order?
|
| Список | pgsql-general |
> Hi. With an integer identity primary key table, > we fetch a number of rows with WHERE id = ANY($1), > with $1 an int[] array. The API using that query must return > rows in the input int[] array order, and uses a client-side > mapping to achieve that currently. > > Is it possible to maintain $1's order directly in SQL? Efficiently? We’ve done this before with an “order by array_index(id, input_array)”. I forget the actual function consider that pseudocode It was only used for small arrays but never noticed any performance issues
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера