#110 ✓invalid
geekounet

Migration #27 fails using PostgreSQL 8.3

Reported by geekounet | September 24th, 2008 @ 02:28 AM

Hi,

I'm trying to install insoshi, with PostgreSQL 8.3, and I get this error during the first migration :

== 27 FixMessageParentId: migrating =========================================== -- change_column(:communications, :parent_id, :integer) rake aborted! PGError: ERROR: column "parent_id" cannot be cast to type "pg_catalog.int4" : ALTER TABLE "communications" ALTER COLUMN "parent_id" TYPE integer

I don't know if the bug comes from the postgres gem or from the migration itself... we should use the USING clause here to convert the values without error.

Comments and changes to this ticket

  • Michael Hartl

    Michael Hartl September 24th, 2008 @ 01:52 PM

    • State changed from “new” to “invalid”

    Since the line uses the Rails-defined change_column function, this appears to be a bug in either the Postgres gem or in Rails, not in Insoshi.

    You'll have my gratitude if you can fix this. Getting everything to work with Postgres is a real pain, especially since I barely know Postgres and can't debug anything too tricky. (The Ultrasphinx plugin for search also has a Postgres bug I haven't been able to crack.)

  • Chris Powell

    Chris Powell October 31st, 2008 @ 03:46 PM

    PostgreSQL user here, too.

    Until Rails or the pg gem repairs this problem, you can work around the issue by removing migration 27 and altering migration 3 to read "t.integer :parent_id".

  • Dan Blue

    Dan Blue July 3rd, 2009 @ 09:31 PM

    Michael is right: Postgres requires (or allows) a special syntax to control how casts are done between the old column type and the new column type. (See http://www.postgresonline.com/journal/index.php?/archives/29-How-to.... The Postgres gem, however, does not support this syntax, hence the cryptic error.

    You could include a special case for Postgres in the migration, but Chris' suggestion was enough to get me back on track.

  • Dan Blue

    Dan Blue July 3rd, 2009 @ 09:37 PM

    Sorry. That last URL was clobbered. The correct link can be found here.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Pages