JakeWheat/hssqlppp — Issue #3: Pretty printing: Quoting in table names
Author: portnov
Created: 2011-10-18 13:41:30+00:00
State: open

PostgreSQL (and, I think, many other RDBMs) requires table identifiers to be quoted in many cases. But HsSqlPpp does not quote them.

For example, printStatement generates:

select ... from Record r, Submmission s ...

while we need:

select ... from "Record" r, "Submission" s ...

Seems such a quoting might be done with simple patch. In Pretty.lhs replace convDqi definition with following:

> convDqi :: SQIdentifier -> Doc
> convDqi (SQIdentifier _ is) = hcat $ punctuate (text ".") $ map (text . quot) is
> where quot x = "\"" ++ x ++ "\""