lib/active_record/connection_adapters/redshift_adapter.rb
# Returns the list of a table's column names, data types, and default values.
#
# The underlying query is roughly:
#  SELECT column.name, column.type, default.value
#    FROM column LEFT JOIN default
#      ON column.table_id = default.table_id
#     AND column.num = default.column_num
#   WHERE column.table_id = get_table_id('table_name')
#     AND column.num > 0
#     AND NOT column.is_dropped
#   ORDER BY column.num
#
# If the table name is not prefixed with a schema, the database will
# take the first match from the schema search path.
#
# Query implementation notes:
#  - format_type includes the column size constraint, e.g. varchar(50)
#  - ::regclass is a function that gives the id for a table name
Returns the list of a table's column names, data types, and default values.

If the table name is not prefixed with a schema, the database will
take the first match from the schema search path.

Query implementation notes:
format_type includes the column size constraint, e.g. varchar(50)
::regclass is a function that gives the id for a table name
Returns the list of a table ' s column names data types and default values . If the table name is not prefixed with a schema the database will take the first match from the schema search path . Query implementation notes : format_type includes the column size constraint e . g . varchar ( 50 ) :: regclass is a function that gives the id for a table name
def column_definitions(table_name) 
          query(<<-end_sql, 'SCHEMA')
              SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
                FROM pg_attribute a LEFT JOIN pg_attrdef d
                  ON a.attrelid = d.adrelid AND a.attnum = d.adnum
               WHERE a.attrelid = '#{quote_table_name(table_name)}'::regclass
                 AND a.attnum > 0 AND NOT a.attisdropped
               ORDER BY a.attnum
          end_sql
        end
def column_definitions ( table_name ) query ( <<-end_sql , 'SCHEMA' ) 
              SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
                FROM pg_attribute a LEFT JOIN pg_attrdef d
                  ON a.attrelid = d.adrelid AND a.attnum = d.adnum
               WHERE a.attrelid = ' #{ quote_table_name ( table_name ) } '::regclass
                 AND a.attnum > 0 AND NOT a.attisdropped
               ORDER BY a.attnum
           end_sql end
Returns the list of a table's column names, data types, and default values.
Returns the list of a table ' s column names data types and default values .
# :nodoc:
table_name