[Nitro] Inheritance/Constraints Bug

Rob Pitt rob at motionpath.com
Thu Dec 22 05:16:51 EST 2005


To be more explicit, I mean a full working mini script, not a full blown
ruby test case as I tried to reproduce it and failed with the following
(which worked fine):

==begin

require 'rubygems'
require 'nitro'
require 'og'

class Loan < Og::Entity
end

class Project < Og::Entity
   has_many :loans, Loan
   schema_inheritance
end

class Loan < Og::Entity
    belongs_to :project, Project
end

class ForeignProject < Project
   property :koko, String
end

class DomesticProject < Project
   property :haha, String
end

Og.setup(
  :store => :psql,
  :address => 'localhost',
  :destroy => true,
  :create_schema => true,
  :evolve_schema => true,
  :evolve_schema_cautious => false,
  :name => 'testx',
  :user => 'user',
  :password => 'password'
)


==end



On Thu, 2005-12-22 at 10:07 +0000, Rob Pitt wrote:
> Please e-mail me a full working test case that causes this error as I
> was unable to reproduce it from your code snippet.
> 
> On Thu, 2005-12-22 at 08:49 +0200, Emmanuel Piperakis wrote:
> > Dear friends,
> > I am not sure but I am afraid this is a bug.
> > class Project
> >    has_many :loans, Loan
> >    schema_inheritance
> > end
> > 
> > class ForeignProject < Project
> >    property :koko, String
> > end
> > 
> > class DomesticProject < Project
> >    property :haha, String
> > end
> > 
> > class Loan
> >    belongs_to :project, Project
> > end
> > 
> >   Og.setup(
> >     :store => :psql,
> >     :destroy => true,
> >     :create_schema => true,
> >     :evolve_schema => true,
> >     :evolve_schema_cautious => false,
> >     :name => 'glycerin',
> >     :user => 'www-weez',
> >     :password => '****'
> >   )
> > 
> > And I get the following error:
> > (which from what I understand Og is trying to make a constraint with a 
> > foreign key of ForeignProject, the moment that due to the 
> > schema_inheritance there is no such oid). Also without schema_inheritance 
> > same error....
> > 
> > G!!!??? Help!
> > 
> > 
> > D, [2005-12-22T14:24:56.437131 #21978] DEBUG -- : PostgreSQL processing 
> > foreign key constraints
> > E, [2005-12-22T14:24:56.449050 #21978] ERROR -- : PostgreSQL connection 
> > returned an error for query ALTER TABLE ogloan ADD CONSTRAINT 
> > ogc_ogloan_foreign_project_oid FOREIGN KEY (foreign_project_oid) 
> > REFERENCES ogproject(oid) ON UPDATE SET NULL ON DELETE SET NULL
> > E, [2005-12-22T14:24:56.449262 #21978] ERROR -- : Og.setup had problems: 
> > RuntimeError => ERROR  C42703  Mcolumn "foreign_project_oid" referenced in 
> > foreign key constraint does not exist      Ftablecmds.c    L4054 
> > RtransformColumnNameList
> > 
> > ==> Setup for debug mode
> > ==> Listening at 0.0.0.0:4001.
> > ==> Press Ctrl-C to shutdown; Run with --help for options.
> > 
> > 
> > Emmanouil Piperakis (epiperak at cs.ntua.gr)
> > {To explore is Human, to Create is Devine,
> >   To teach is Primal, to Rule is Sin}
> > _______________________________________________
> > Nitro-general mailing list
> > Nitro-general at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/nitro-general
> 
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general




More information about the Nitro-general mailing list