Postgres will return the plan when you prefix the actual SQL statement with 'EXPLAIN' or 'EXPLAIN ANALYZE'.

EXPLAIN will get the plan without executing it, EXPLAIN ANALYZE will also execute it, then returns the plan and some detail of the result (like the number of rows); both output a table-like structure with 1 column: 'QUERY PLAN'.