lib/sequel_core/adapters/shared/postgres.rb
def schema_parser_dataset(table_name, opts)
        ds = dataset.select(:pg_attribute__attname___name,
            SQL::Function.new(:format_type, :pg_type__oid, :pg_attribute__atttypmod).as(:db_type),
            SQL::Function.new(:pg_get_expr, :pg_attrdef__adbin, :pg_class__oid).as(:default),
            SQL::BooleanExpression.new(:NOT, :pg_attribute__attnotnull).as(:allow_null),
            SQL::Function.new(:COALESCE, {:pg_attribute__attnum => SQL::Function.new(:ANY, :pg_index__indkey)}.sql_expr, false).as(:primary_key)).
          from(:pg_class).
          join(:pg_attribute, :attrelid=>:oid).
          join(:pg_type, :oid=>:atttypid).
          left_outer_join(:pg_attrdef, :adrelid=>:pg_class__oid, :adnum=>:pg_attribute__attnum).
          left_outer_join(:pg_index, :indrelid=>:pg_class__oid, :indisprimary=>true).
          filter(:pg_attribute__attisdropped=>false).
          filter(:pg_attribute__attnum > 0).
          order(:pg_attribute__attnum)
        if table_name
          ds.filter!(:pg_class__relname=>table_name.to_s)
        else
          ds.select_more!(:pg_class__relname___table)
        end
        ds.join!(:pg_namespace, :oid=>:pg_class__relnamespace, :nspname=>(opts[:schema] || default_schema).to_s) if opts[:schema] || !opts.include?(:schema)
        ds
      end
# The dataset used for parsing table schemas, using the pg_* system catalogs.
The dataset used for parsing table schemas, using the pg_* system catalogs.
The dataset used for parsing table schemas using the pg_ * system catalogs .
def schema_parser_dataset(table_name, opts)
        ds = dataset.select(:pg_attribute__attname___name,
            SQL::Function.new(:format_type, :pg_type__oid, :pg_attribute__atttypmod).as(:db_type),
            SQL::Function.new(:pg_get_expr, :pg_attrdef__adbin, :pg_class__oid).as(:default),
            SQL::BooleanExpression.new(:NOT, :pg_attribute__attnotnull).as(:allow_null),
            SQL::Function.new(:COALESCE, {:pg_attribute__attnum => SQL::Function.new(:ANY, :pg_index__indkey)}.sql_expr, false).as(:primary_key)).
          from(:pg_class).
          join(:pg_attribute, :attrelid=>:oid).
          join(:pg_type, :oid=>:atttypid).
          left_outer_join(:pg_attrdef, :adrelid=>:pg_class__oid, :adnum=>:pg_attribute__attnum).
          left_outer_join(:pg_index, :indrelid=>:pg_class__oid, :indisprimary=>true).
          filter(:pg_attribute__attisdropped=>false).
          filter(:pg_attribute__attnum > 0).
          order(:pg_attribute__attnum)
        if table_name
          ds.filter!(:pg_class__relname=>table_name.to_s)
        else
          ds.select_more!(:pg_class__relname___table)
        end
        ds.join!(:pg_namespace, :oid=>:pg_class__relnamespace, :nspname=>(opts[:schema] || default_schema).to_s) if opts[:schema] || !opts.include?(:schema)
        ds
      end
def schema_parser_dataset ( table_name , opts ) ds = dataset . select ( :pg_attribute__attname___name , SQL :: Function . new ( :format_type , :pg_type__oid , :pg_attribute__atttypmod ) . as ( :db_type ) , SQL :: Function . new ( :pg_get_expr , :pg_attrdef__adbin , :pg_class__oid ) . as ( :default ) , SQL :: BooleanExpression . new ( :NOT , :pg_attribute__attnotnull ) . as ( :allow_null ) , SQL :: Function . new ( :COALESCE , { :pg_attribute__attnum => SQL :: Function . new ( :ANY , :pg_index__indkey ) } . sql_expr , false ) . as ( :primary_key ) ) . from ( :pg_class ) . join ( :pg_attribute , :attrelid => :oid ) . join ( :pg_type , :oid => :atttypid ) . left_outer_join ( :pg_attrdef , :adrelid => :pg_class__oid , :adnum => :pg_attribute__attnum ) . left_outer_join ( :pg_index , :indrelid => :pg_class__oid , :indisprimary => true ) . filter ( :pg_attribute__attisdropped => false ) . filter ( :pg_attribute__attnum > 0 ) . order ( :pg_attribute__attnum ) if table_name ds . filter! ( :pg_class__relname => table_name . to_s ) else ds . select_more! ( :pg_class__relname___table ) end ds . join! ( :pg_namespace , :oid => :pg_class__relnamespace , :nspname => ( opts [ :schema ] || default_schema ) . to_s ) if opts [ :schema ] || ! opts . include? ( :schema ) ds end
The dataset used for parsing table schemas, using the pg_* system catalogs.
The dataset used for parsing table schemas using the pg_ * system catalogs .
table_name
opts