I want to query a full JSON array in PostgreSQL (as in, check if there's a JSON array in the table matching my input JSON array)
In MySQL I used to do:
SELECT * from <table> where <column> = JSON_ARRAY("A", "B", "C", "D", "E");
In Laravel:
return $this->whereRaw("<column> = JSON_ARRAY(" . "'" . implode("','", json_encode(explode(',', preg_replace('/\s+/', '', $input)))) . "'" . ")");
And it worked fine (even though the code in Laravel wasn't probably the best way of doing it, in which case I'm open to suggestions on how to improve the code). I want to know a query in PostgreSQL that behaves exactly the same way as the MySQL query i've written.
Thanks in advance.