However, I think what would make a ton of sense is a coffeescript-esque PL/pgSQL, complete with runtime. Basically an easier to use psql shell (or equivalent for another DB). Postgres is incredibly powerful, and I feel like could be a much more useful interactive tool for loading up CSVs, doing some querying, modifying, etc, with a little friendlier or more programmer-familiar environment.
I'm picturing something closer to "emmet"[1], where you write some shorthand and this gets expanded to proper SQL in line. So our imaginary sql-script would never see the light of git, most of the time you'd use it through an IDE plugin or vim's "!" filter (although you could have it available as a function at runtime and actually save the simplified code). Actual database access at this stage would be good, I wouldn't mind e.g. globbing column names or excluding some ("sel *-[{created,updated}_at]")...
But you're right, for something like psql this would make good sense, too. And after you've played arond with it, you can paste the proper SQL wherever you needed it, too.