Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #11573 (new defect)

Opened 1 month ago

Last modified 1 month ago

add_column bug for PostgreSQL

Reported by: skyeagle Assigned to: core
Priority: normal Milestone: 2.x
Component: ActiveRecord Version: edge
Severity: normal Keywords:
Cc:

Description

In migrations "add_column" does't update exists records with :default value if :nulls => false not set for PostgreSQL database

Attachments

postgresql_adapter.rb.diff (1.7 kB) - added by skyeagle on 04/11/08 13:58:47.
PATCH to postgresql adapter

Change History

04/11/08 13:58:47 changed by skyeagle

  • attachment postgresql_adapter.rb.diff added.

PATCH to postgresql adapter

04/11/08 14:39:33 changed by tarmo

Could you explain in more detail what behavior the patch changes? Other than adding the column with one query as opposed to adding it and then changing the default/nullability with additional queries I can't see what behavior is changed.

The patch does not contain a testcase, but there is a test "test_add_column_not_null_with_default" in "activerecord/test/cases/migration_test.rb" which seems like it tests this behavior?

Also the patch uses tabs for indentation, those should be replaced with two spaces. And it would be good if the patch was based on the rails repository root so it would be easier to apply.

Thank you,