Create a runtime table in PostgreSQL
You can prepare a query with a VALUES expression:

SELECT a.*, b.*
FROM  (
   VALUES 
      (id1a, id2a)
     ,(id1b, id2b)
     , ...
   )   t(id1, id2)
JOIN   tablea a ON a.id = t.id1
JOIN   tableb b ON b.id = t.id2;


Or you COPY the values from the text file to a temporary table and proceed from there:

CREATE TEMP TABLE t(id1 int, id2 int);

COPY t FROM '/path/to/file.csv';

SELECT a.*, b.*
FROM   t
JOIN   tablea a ON a.id = t.id1
JOIN   tableb b ON b.id = t.id2;