liveh2o/spectacles — pull request #6 by nickmabry (2014-12-04 17:03:08+00:00)
Title: Fix postgres view dump returning unescaped double quotes

Howdy! We were using `spectacles` to interface with a fairly complex Postgres view, created with a SQL string literal in a migration. When the `create_view` call was serialized to Rails' `schema.rb`, it contained unescaped double-quotes and would throw errors when restoring from schema.

We're still not sure exactly when this is the case, but Postgres can return double-quotes in its `table_schema` for certain view tables. Our quick fix was to patch the `spectacles` Postgres adapter to manually escape the returned SQL before ActiveRecord serialized it to `schema.rb`.

Please let me know if there's anything we can do to get this pushed upstream, or if this isn't an appropriate place for the fix. Thanks!