So

Table A references B
B references C
C references A

works fine in postgresql with inline constraints.  Then I have no
opposition to the simpler syntax.  If not maybe you could set table.vm
and tablefk.vm to use inlinefk.vm and foreignkey.vm.  Then inline only
those fk's that have onDelete or onUpdate set.  Print the rest at the
end.

?

John McNally



Mike Haberman wrote:
> 
> how about adding a directive in db.props (much like the
> indexInsideTableDirective) ?
> 
> The problem with the code generation for postgres is that you
> can't specify on DELETE or on UPDATE with the syntax given:
> ADD CONSTRAINT $fk.LocalColumnNames FOREIGN KEY ($fk.LocalColumnNames)
>     REFERENCES $fk.ForeignTableName ($fk.ForeignColumnNames);
> 
> The alternative is then to produce contraint triggers whose syntax
> is dependant on which version of postgres you are using.
> 
> The dtd changes I made and the changes to ForeignKey.java are
> completely independent of the circular reference problem.
> 
> I can go ahead and add the correct syntax for contraint triggers
> but it will only work for postgres 7.1.x.
> 
> let me know,
> 
> mike
> 
> On Thu, Jun 21, 2001 at 02:03:30PM -0700, John McNally wrote:
> > The reason the fk's were moved to the end was prevent problems with
> > circular references and ordering issues in general.  What happens if
> > table(id) is defined after the proposed line?
> >
> > john mcnally
> >
> > Mike Haberman wrote:
> > >
> > > Got all the code done and it's tested.  Waiting for approval  :)
> > >
> > > mike
> > >
> > > On Thu, Jun 21, 2001 at 10:36:24AM -0500, Mike Haberman wrote:
> > > > I would like to add the onDelete and onUpdate attributes to
> > > > the foreign key in the dtd.
> > > >
> > > > <!ELEMENT foreign-key (reference+)>
> > > > <!ATTLIST foreign-key
> > > >   foreignTable CDATA #REQUIRED
> > > >   onUpdate (cascade|set null|restrict|none) "none"
> > > >   onDelete (cascade|set null|restrict|none) "none"
> > > > >
> > > >
> > > >
> > > > Also, at least for postgres, I would like to generate the foreign key
> > > > stuff in line (instead of generating it after the table).  It's much
> > > > more elegant (and easier) to generate :
> > > >
> > > >   colname type REFERENCES table(id) ON DELETE cascade,
> > > >
> > > >   than
> > > >
> > > > CREATE TRIGGER if_dist_exists
> > > >     BEFORE INSERT OR UPDATE ON films FOR EACH ROW
> > > >     EXECUTE PROCEDURE check_primary_key ('col', 'table', 'col');
> > > >
> > > > CREATE TRIGGER if_film_exists
> > > >     BEFORE DELETE OR UPDATE ON distributors FOR EACH ROW
> > > >     EXECUTE PROCEDURE check_foreign_key (1, 'CASCADE', 'col', 'table', 'col');
> > > >
> > > >
> > > > mike
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > > --
> > > -------------------------------------------------
> > > I am Vinz, Vinz Clortho.  Keymaster of Gozer,
> > > Volguus Zildrohar, Lord of the Sebouillia.
> > > Are you the Gatekeeper?
> > > -------------------------------------------------
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> 
> --
> -------------------------------------------------
> I am Vinz, Vinz Clortho.  Keymaster of Gozer,
> Volguus Zildrohar, Lord of the Sebouillia.
> Are you the Gatekeeper?
> -------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to