gbwey/persistent-odbc

Is there a reason for escapeDBName?

Opened this issue · 0 comments

Hi,

I'm new to Persistent and to Haskell. Persistent can already annotate table names and columns names using the sql modifier on the Persistent entity. The private function escapeDNName in MigrateMSSQL.hs encloses the table name in square parentheses. However, this is bad behaviour as the only way to specify the fully qualified table name is through the sql attribute on the Entity.

Querying the table sys.all_columns is an impossible query as it exists in the the schema 'sys'. However, persistent-odbc wraps sys.all_columns in square brackets. The database attempts to find [sys.all_columns] in the schema 'dbo' and then throws an exception because the table doesn't exist.

Just wondering if there was a reason to enclose all names of objects in square brackets rather than just letting the user annotate the columns when they need to?