
How to read CREATE TABLE SQL with pg_query
pg_query is a really cool Ruby library that uses Postgres's query parser to give you programmatic access to SQL queries. One thing you can do with it is read a CREATE TABLE statement to map column names to column types: sql = <<-SQL CREATE TABLE example ( my_text