Add a hook to allow complex aliases

To allow queries like
SELECT * FROM (VALUES ($1, $2), ($3, $4)) V (name, value)