SQL - find records that are prefixes of my string
First, your way of using [I]LIKE is wrong:


string LIKE pattern 



So, string first, pattern second.

Furthermore, as you are after prefixes only, the starting wildcard is not needed.  Something like this should work:

SELECT * FROM my_table WHERE 'aaaabbbbccccdddd' ILIKE prefix || '%';


A small proof of this:

WITH my_table (prefix) AS (
VALUES ('abcde'),
       ('abcd'),
       ('abcE'),
       ('bcde')
)
SELECT * FROM my_table WHERE 'abcdefghijkl' ILIKE prefix || '%';

 prefix 
────────
 abcde
 abcd