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

Ticket #11523 (new defect)

Opened 1 month ago

Postgresql: invalid default values for the string type

Reported by: tonton Assigned to: core
Priority: normal Milestone: 2.x
Component: ActiveRecord Version: edge
Severity: normal Keywords: postgresql string default
Cc:

Description

With a simple migration: create_table :test do |t|

t.string :test t.string :test2, :default =>

end

The default value for test is 'NULL::character varying', not NULL. The default value for test2 is (valid) if you run rake db:migrate, but if you run db:schema:load, it will be ::character varying'. The generated schema.rb is also invalid.

Postgresql says that the schema after rake db:schema:load is: =# \d test

Table "public.test"

Column | Type | Modifiers


test | character varying(255) | default 'NULL::character varying'::character varying test2 | character varying(255) | default ::character varying'::character varying

This is with postgresql 8.3.1, rails 2.0.2 and ruby-postgres 0.7.1 (Debian sid).