# Data Explorer의 \`int\_list\`가 첫 번째 요소를 0으로 대체함

**URL:** <https://meta.discourse.org/t/data-explorer-int-list-replaces-1st-element-with-0/146552>\
**Category:** Product Support\
**Tags:** data-explorer\
**Created:** [4월 2, 2020, 8:31오전 UTC](https://meta.discourse.org/t/data-explorer-int-list-replaces-1st-element-with-0/146552 "2020-04-02T08:31:37Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![AstonJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/astonj/32/215041_2.png) [@AstonJ](https://meta.discourse.org/u/AstonJ)\
**Post date:** [4월 2, 2020, 8:31오전 UTC](https://meta.discourse.org/t/data-explorer-int-list-replaces-1st-element-with-0/146552/1 "2020-04-02T08:31:37Z")

</div>

이것이 버그인지 아니면 제가 무언가를 잘못하고 있는지는 확신이 서지 않지만, [data explorer](https://meta.discourse.org/t/32566?silent=true) 쿼리에서 `int_list` 배열의 첫 번째 요소가 항상 0으로 대체되는 것 같습니다.

예를 들어:

```plaintext
-- int_list :categories = "3, 5, 6"

```

이것은 `[0, 5, 6]`으로 변경됩니다.

다음 부분을 확인해 보면:

> <https://github.com/discourse/discourse-data-explorer/blob/main/plugin.rb#L942>

콘솔에서 이렇게 하면 예상되는 출력을 얻습니다:

```plaintext
string = "3,5,6"
value = string.split(',').map { |s| s.downcase == '#null' ? nil : s.to_i }
=> [3, 5, 6]

```

다음 쿼리로 재현할 수 있습니다:

```plaintext
-- [params]
-- int_list :categories = "3, 5, 6"

SELECT *
FROM topics 
WHERE topics.category_id = ANY (ARRAY [:categories] )

```

이를 깨뜨리면(오류를 볼 수 있도록) 단순히 닫는 괄호를 제거하면 됩니다. 예를 들어:

```plaintext
-- [params]
-- int_list :categories = "3, 5, 6"

SELECT *
FROM topics 
WHERE topics.category_id = ANY (ARRAY [ :categories )

```

```plaintext
PG::SyntaxError: ERROR: syntax error at or near ")"
LINE 12: WHERE topics.category_id = ANY (ARRAY [ 0,5,6 )
                                                         ^

```

(배열을 살펴보세요)

---

_[View the full topic](https://meta.discourse.org/t/data-explorer-int-list-replaces-1st-element-with-0/146552)._
