Get IDs of similar rows by criteria
You can use the aggregate function array_agg() for this purpose.




select price, type, array_agg(id) ids
from   tbl
group by price, type



price | type  | ids    
----: | :---- | :------
 1.00 | fruit | {1,2,3}
 2.00 | veg   | {4,5,6}



dbfiddle here