I am trying to get values for which part of their ids is in a defined list. Let's say that we have a table called ABC
CREATE TABLE abc
AS
SELECT post_id
FROM ( VALUES
( '868164246578472_912876412107255' ),
( '868164246578472_912883258773237' ),
( '868164246578472_913049595423270' )
) AS t(post_id);
Then I just take a part after the underscore
select (regexp_split_to_array(element_id, '_'))[2] as element_id from ABC limit 3;
element_id
-----------------
912876412107255
912883258773237
913049595423270
Now I want to take only those elements, where their element_ids are in a defined list yet I get no results
select (regexp_split_to_array(post_id, '_'))[2] as post_id from ABC where post_id = ANY('{912876412107255, 912883258773237}'::text[]) limit 3;
post_id
---------
(0 rows)
I also tried this:
select (regexp_split_to_array(post_id, '_'))[2]::text[] as post_id from ABC where post_id IN ('912876412107255', '912876412107255') limit 3;
post_id
---------
(0 rows)
The structure of the table is as follows:
Table "public.ABC"
Column | Type | Modifiers
---------------+-----------------------------+------------------------------------------------------
id | integer | not null default nextval('ABC_id_seq'::regclass)
element_id | text | not null