Just to follow up here --- I put this patch on hold for a few days because I had to work on release notes. Now I'm glad I did, because Robert Haas is pushing a proposal that would change the basis of discussion:
https://www.postgresql.org/message-id/flat/CA%2BTgmoYSYmDA2GvanzPMci084n%2BmVucv0bJ0HPbs6uhmMN6HMg%40mail.gmail.com If we do what he suggests there, then referencing "*VALUES*" in a subquery with VALUES and ORDER BY would be broken anyway. In that case I'd favor committing this patch as-is, to provide users with a well-defined new behavior. So I think this should stay on hold a bit longer to see what the outcome of that discussion is. regards, tom lane