I have two columns say Main and Sub. (they can be of same table or not).
Main is varchar of length 20 and Sub is
Argument to a LIKE is an ordinary string, so all string manipulations are valid here. In your case you need to concatenate wildchars with the target substring, like @bksi suggests:
... LIKE '%'||CAST("SubColumn" AS test) ...
Note, though, that such patterns (the ones starting with a % wildcard) are badly performing ones. Take a look at PostgreSQL LIKE query performance variations.
I would recommend:
substr("MainColumn", 13, 8) approach;LIKE and use equality comparison (=) instead (although they're equal if LIKE pattern contains no wildcards, it is easier to read the query);build an expression index on the "MainTable" the following way:
CREATE INDEX i_maincolumn ON "MainTable" (substr("MainColumn", 13, 8));
This combination will perform better in my view.
And use lowercase names for the tables/columns, so that you can avoid doublequoting them.