views:

98

answers:

1

I've problem with default modifiers on postgres 8.4. (I think version is its not important) I've debian ubuntu. When Im creating migrations on rails AR:

    class CreateUserMails < ActiveRecord::Migration
  def self.up
    create_table :user_mails do |t|
      t.string :title, :limit=> 128, :default=> ''
      t.string :place, :limit=> 32, :default=> ''
      t.text :message
      t.timestamps
    end
  end

  def self.down
    drop_table :user_mails
  end
end

on postgres its looking like this:

    Column    |            Type             |                        Modifiers
--------------+-----------------------------+---------------------------------------------------------
 id           | integer                     | not null default nextval('user_mails_id_seq'::regclass)
 title        | character varying(128)      | default ''::character varying
 place        | character varying(32)       | default ''::character varying
 message      | text                        |
 created_at   | timestamp without time zone |
 updated_at   | timestamp without time zone |

no on console as default values Im getting

um = UserMail.new => #UserMail id: nil, title: "''::character varying", place: "''::character varying", message: nil, created_at: nil, updated_at: nil

does anybody has any idea how I can remove those modifiers and leave only '' or any default value without: ::character varying?

A: 

There is no way to do that. It's not clear why you would want to, besides aesthetics.

Peter Eisentraut