postgres inheritance

View: New views
5 Messages — Rating Filter:   Alert me  

postgres inheritance

by albert-45 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I've been searching through multiple sites including this official
mailing list, on how to implement postgres table inheritance using
tedia2sql. There's some mentions about this feature being implemented,
but sadly enough, grepping through a fresh cvs checked-out revision
has returned me no results.

I'm looking for a way to represent this postgres definition:

CREATE TABLE a (...) with oids;
CREATE TABLE b (...) inherits a;

on a dia diagram which tedia2sql can understand properly.

best regards

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: postgres inheritance

by Mike Ginou :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Albert,

Unfortunately, I don't have any experience with inheritence in an RDBMS.
Therefore, I don't think I'm in a good position to add this feature.

If you're willing to dig into it yourself, I would be more than happy to
offer suggestions and to answer any questions you might have.

Cheers,
Mike

albert wrote:

> Hi all,
>
> I've been searching through multiple sites including this official
> mailing list, on how to implement postgres table inheritance using
> tedia2sql. There's some mentions about this feature being implemented,
> but sadly enough, grepping through a fresh cvs checked-out revision
> has returned me no results.
>
> I'm looking for a way to represent this postgres definition:
>
> CREATE TABLE a (...) with oids;
> CREATE TABLE b (...) inherits a;
>
> on a dia diagram which tedia2sql can understand properly.
>
> best regards
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: postgres inheritance

by albert-45 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mike,

Thank you for your support. I have momentarily hacked tedia2sql perl
script to add inheritance to postgres tables when a class is found to
have an operation named "inherits". Its type is used to refer to the
table name it inherits from. Ugly, but it works for the timing
deadline I am currently on.

Problems:

1. The correct way to interpret inheritance is, as I understand it,
make use of the "Generalization" association type. Have digged into
the source and guess the correct approach is to add the inheritance
info into the class definition when traversing through the association
nodes (a function called generateAssocSqlFromNodeList if I'm not
mistaken).

2. On complex diagrams, the ordering of table definitions will
eventually upset postgres at import time (an inheriting table has to
be defined after the table it inherits from). Not sure if Dia's object
Z-order might help, but safest solution I guess is to build a
parent-child relationship tree during diagram scanning.

Unfortunately am not very skillfull on Perl, but I am more than happy
to help implement and document it if there's interest. Let me know if
you'd like me to forward the temporary patch.

best regards
albert

2007/4/18, Mike Ginou <mike@...>:

> Albert,
>
> Unfortunately, I don't have any experience with inheritence in an RDBMS.
> Therefore, I don't think I'm in a good position to add this feature.
>
> If you're willing to dig into it yourself, I would be more than happy to
> offer suggestions and to answer any questions you might have.
>
> Cheers,
> Mike
>
> albert wrote:
> > Hi all,
> >
> > I've been searching through multiple sites including this official
> > mailing list, on how to implement postgres table inheritance using
> > tedia2sql. There's some mentions about this feature being implemented,
> > but sadly enough, grepping through a fresh cvs checked-out revision
> > has returned me no results.
> >
> > I'm looking for a way to represent this postgres definition:
> >
> > CREATE TABLE a (...) with oids;
> > CREATE TABLE b (...) inherits a;
> >
> > on a dia diagram which tedia2sql can understand properly.
> >
> > best regards
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@...
> > For additional commands, e-mail: users-help@...
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: postgres inheritance

by Mike Ginou :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes! Please do forward the patch. I would very much like to take a look
at it.

-Mike

albert wrote:

> Mike,
>
> Thank you for your support. I have momentarily hacked tedia2sql perl
> script to add inheritance to postgres tables when a class is found to
> have an operation named "inherits". Its type is used to refer to the
> table name it inherits from. Ugly, but it works for the timing
> deadline I am currently on.
>
> Problems:
>
> 1. The correct way to interpret inheritance is, as I understand it,
> make use of the "Generalization" association type. Have digged into
> the source and guess the correct approach is to add the inheritance
> info into the class definition when traversing through the association
> nodes (a function called generateAssocSqlFromNodeList if I'm not
> mistaken).
>
> 2. On complex diagrams, the ordering of table definitions will
> eventually upset postgres at import time (an inheriting table has to
> be defined after the table it inherits from). Not sure if Dia's object
> Z-order might help, but safest solution I guess is to build a
> parent-child relationship tree during diagram scanning.
>
> Unfortunately am not very skillfull on Perl, but I am more than happy
> to help implement and document it if there's interest. Let me know if
> you'd like me to forward the temporary patch.
>
> best regards
> albert
>
> 2007/4/18, Mike Ginou <mike@...>:
>> Albert,
>>
>> Unfortunately, I don't have any experience with inheritence in an RDBMS.
>> Therefore, I don't think I'm in a good position to add this feature.
>>
>> If you're willing to dig into it yourself, I would be more than happy to
>> offer suggestions and to answer any questions you might have.
>>
>> Cheers,
>> Mike
>>
>> albert wrote:
>> > Hi all,
>> >
>> > I've been searching through multiple sites including this official
>> > mailing list, on how to implement postgres table inheritance using
>> > tedia2sql. There's some mentions about this feature being implemented,
>> > but sadly enough, grepping through a fresh cvs checked-out revision
>> > has returned me no results.
>> >
>> > I'm looking for a way to represent this postgres definition:
>> >
>> > CREATE TABLE a (...) with oids;
>> > CREATE TABLE b (...) inherits a;
>> >
>> > on a dia diagram which tedia2sql can understand properly.
>> >
>> > best regards
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@...
>> > For additional commands, e-mail: users-help@...
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: postgres inheritance

by albert-45 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is this diff format suitable to you?

Index: tedia2sql
===================================================================
RCS file: /cvs/tedia2sql/tedia2sql,v
retrieving revision 1.68
diff -r1.68 tedia2sql
1210a1211,1214
>               if ($opt_t eq 'postgres') {
>                 &addInheritance ($createFileHandle, $objectOperations)
>               }
>
1242a1247,1270

> # Inheritance is temporarily resolved using a class operation called "inherits", whose
> # type is interpreted as the name of the table the class is inheriting from.
> # The correct way to go should be the use of generalization assocation links.
> #
> # TODO: interpret relation "generalization, class inheritance" from UML diagram instead.
> #       Implement table declaration ordering (they must be declared after their ancestor tables),
> #       probably safest way is create inheritance tree during diagram scanning.
> #       Handle multiple inheritance: inherits (a,b,c)
> #
>
> sub addInheritance($$$) {
>
>   my $createFileHandle = shift;
>   my $theOperations = shift;
>
>   foreach my $oneOp (@$theOperations) {
>     my ($opName, $opType, $opParams) = @$oneOp;
>     if ($opName eq 'inherits') {
>       print "* table inherits from: $opType\n" if ($verbose);
>       print $createFileHandle "inherits ($opType) ";
>     }
>   }
> }
>


2007/4/18, Mike Ginou <mike@...>:

> Yes! Please do forward the patch. I would very much like to take a look
> at it.
>
> -Mike
>
> albert wrote:
> > Mike,
> >
> > Thank you for your support. I have momentarily hacked tedia2sql perl
> > script to add inheritance to postgres tables when a class is found to
> > have an operation named "inherits". Its type is used to refer to the
> > table name it inherits from. Ugly, but it works for the timing
> > deadline I am currently on.
> >
> > Problems:
> >
> > 1. The correct way to interpret inheritance is, as I understand it,
> > make use of the "Generalization" association type. Have digged into
> > the source and guess the correct approach is to add the inheritance
> > info into the class definition when traversing through the association
> > nodes (a function called generateAssocSqlFromNodeList if I'm not
> > mistaken).
> >
> > 2. On complex diagrams, the ordering of table definitions will
> > eventually upset postgres at import time (an inheriting table has to
> > be defined after the table it inherits from). Not sure if Dia's object
> > Z-order might help, but safest solution I guess is to build a
> > parent-child relationship tree during diagram scanning.
> >
> > Unfortunately am not very skillfull on Perl, but I am more than happy
> > to help implement and document it if there's interest. Let me know if
> > you'd like me to forward the temporary patch.
> >
> > best regards
> > albert
> >
> > 2007/4/18, Mike Ginou <mike@...>:
> >> Albert,
> >>
> >> Unfortunately, I don't have any experience with inheritence in an RDBMS.
> >> Therefore, I don't think I'm in a good position to add this feature.
> >>
> >> If you're willing to dig into it yourself, I would be more than happy to
> >> offer suggestions and to answer any questions you might have.
> >>
> >> Cheers,
> >> Mike
> >>
> >> albert wrote:
> >> > Hi all,
> >> >
> >> > I've been searching through multiple sites including this official
> >> > mailing list, on how to implement postgres table inheritance using
> >> > tedia2sql. There's some mentions about this feature being implemented,
> >> > but sadly enough, grepping through a fresh cvs checked-out revision
> >> > has returned me no results.
> >> >
> >> > I'm looking for a way to represent this postgres definition:
> >> >
> >> > CREATE TABLE a (...) with oids;
> >> > CREATE TABLE b (...) inherits a;
> >> >
> >> > on a dia diagram which tedia2sql can understand properly.
> >> >
> >> > best regards
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@...
> >> > For additional commands, e-mail: users-help@...
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@...
> >> For additional commands, e-mail: users-help@...
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@...
> > For additional commands, e-mail: users-help@...
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

LightInTheBox - Buy quality products at wholesale price