Answer the question
In order to leave comments, you need to log in
Is it possible to do a native SELECT in PostgreSQL on an int[] field?
There are 2 tables. In the first - a list of articles, in the second - a list of categories. One article can belong to several categories. To do this, the table with articles has a field of type int[] (array) with category IDs. Is it possible to select articles with category names with a simple SELECTOM? Or do you need to get confused with functions?
Answer the question
In order to leave comments, you need to log in
It is possible, type SELECT * FROM table WHERE 17 = ANY(id) It is
possible to put GIN indexes.
Take a closer look at the manual, which describes arrays. Everything is there
Using
SELECT * FROM table WHERE 17 = ANY(id)duplicate results will be blown out, but you need one result with all the category names, id that is in the record.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question