Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Postgres: Invalid default value getting from character varying columns.

#2683

Migrating script:

    create_table "order_users", :force => true do |t|

  t.string   "username",      :limit => 50
  t.string   "email_address", :limit => 50, :default => "test1", :null => false
  t.string   "password",      :limit => 20
  t.datetime "created_on"
  t.string   "first_name",    :limit => 50, :default => "test2", :null => false
  t.string   "last_name",     :limit => 50, :default => "test3", :null => false
end</code>



Creating new object:

>> OrderUser.new
=> #<OrderUser id: nil, username: nil, email_address: "'test1'::character varying", password: nil, created_on: nil, first_name: "'test2'::character varying", last_name: "'test3'::character varying">

Rails 2.3.2
Postgresql 8.3.7
postgres gem (0.7.9.2008.01.28)

Reported by foot · May 20th, 2009 @ 08:00 PM

State: resolved
Milestone: 3.x
Assigned to: Tarmo Tänav Tarmo Tänav
Importance: none

Activity

  1. foot
    foot

    This happens because postgres adapter use ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::PostgreSQLColumn class (where it find it?) for columns definition instead ActiveRecord::ConnectionAdapters::PostgreSQLColumn class.

    This modification helps for me.

    May 21st, 2009 @ 10:42 AM

  2. chrispanda
    chrispanda

    This patch works for me +1

    July 24th, 2009 @ 10:33 AM

  3. Michael Koziarski
    Michael Koziarski
    • Assigned user set to Tarmo Tänav

    August 3rd, 2009 @ 06:06 AM

  4. edraut
    edraut

    This bug is caused by the acts_as_tsearch plugin. I'll include a patch here to show why, but it looks like there is no bug in active_record. I suggest closing this. I will submit the patch to the acts_as_tsearch maintainer.

    August 26th, 2009 @ 02:33 PM

  5. foot
    foot

    Thanks! This works for me. In my project the acts_as_tsearch plugin was installed.

    August 26th, 2009 @ 05:08 PM

  6. sarah (at ultrasaurus)
    sarah (at ultrasaurus)

    patch applied (plus other improvements to acts_as_tsearch) at: http://github.com/wolframarnold/acts_as_tsearch

    December 13th, 2009 @ 04:37 PM

  7. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.x to 3.x

    May 4th, 2010 @ 06:48 PM

  8. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to resolved
    • Importance changed from to

    October 9th, 2010 @ 04:13 AM

  9. Ryan Bigg
    Ryan Bigg
    • Tag cleared.

    Automatic cleanup of spam.

    October 14th, 2010 @ 05:29 AM