Skip Menu |

This queue is for tickets about the Parse-Dia-SQL CPAN distribution.

Report information
The Basics
Id: 91175
Status: open
Priority: 0/
Queue: Parse-Dia-SQL

People
Owner: Nobody in particular
Requestors: andrews [...] seventest.ru
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: problem with processing of aggregation/composition in UML mode
Date: Wed, 04 Dec 2013 18:27:49 +0400
To: bug-Parse-Dia-SQL [...] rt.cpan.org
From: Andrej Shalaev <andrews [...] seventest.ru>
Hello! Parse-Dia-SQL version: 0.25 Dia version: 0.97.1 The example file composition.dia contains two entities: 'one' and 'two'. Entity 'one' composes many entities of 'two' Below is the log of parsediasql binary execution: ===== $ parsediasql --uml --file composition.dia --db postgres > composition.sql Use of uninitialized value in addition (+) at /usr/local/share/perl/5.10.1/Parse/Dia/SQL.pm line 1725. Use of uninitialized value in addition (+) at /usr/local/share/perl/5.10.1/Parse/Dia/SQL.pm line 1725. [INFO] components is an empty ARRAY ref ===== We can see warnings at SQL.pm line 1725. Resulting composition.sql contains next command: ===== alter table two add constraint two_fk_One_id foreign key (one_id) references one (id) ; ===== As we can see, there's no ON DELETE CASCADE constraint which should be added regarding tedia2sql documentation: ===== UML mode Whichever side is aggregate or composition is the 'one' side in the one-to-many relationship. The multiplicity of the other side may be specified in the usual way. If the relationship is aggregate, a on delete set NULL is added to the foreign key constraint in databases that support it; if it is a composition, then on delete cascade is added instead. ===== Same situation has to be for aggregation (ON DELETE SET NULL is not presented). Thank you for your product and for your attention!

Message body is not shown because sender requested not to inline it.

Download composition.dia
application/x-dia-diagram 1.3k

Message body not shown because it is not plain text.

On Wed Dec 04 09:28:10 2013, andrews@seventest.ru wrote: Show quoted text
> As we can see, there's no ON DELETE CASCADE constraint which should be > added regarding tedia2sql documentation:
I don't understand exactly what the problem is. A complete example with .dia file and test files would be helpful, preferrably in the form of a github pull request. E.g. like this recent example by Felix Ostmann: https://github.com/aff/Parse-Dia-SQL/commit/92ae16e3f97a3de76cd7a9f91c24615925f833e1
From: felix.ostmann [...] gmail.com
Am Di 17. Dez 2013, 16:21:25, AFF schrieb: Show quoted text
> On Wed Dec 04 09:28:10 2013, andrews@seventest.ru wrote:
> > As we can see, there's no ON DELETE CASCADE constraint which should > > be > > added regarding tedia2sql documentation:
> > I don't understand exactly what the problem is. A complete example > with .dia file and test files would be helpful, preferrably in the > form of a github pull request. E.g. like this recent example by Felix > Ostmann: > > https://github.com/aff/Parse-Dia- > SQL/commit/92ae16e3f97a3de76cd7a9f91c24615925f833e1
Perhaps this is related to RT #66031 ... please provide a .dia and a test and i can see if i understand your problem. We are only using uml-mode with many special cases, perhaps i can fix it for you (and me ;) ).
Subject: Re: [rt.cpan.org #91175] problem with processing of aggregation/composition in UML mode
Date: Wed, 18 Dec 2013 12:46:39 +0400
To: bug-Parse-Dia-SQL [...] rt.cpan.org
From: Andrej Shalaev <andrews [...] seventest.ru>
Hello! В Срд, 18/12/2013 в 03:11 -0500, Felix Antonius Wilhelm Ostmann via RT пишет: Show quoted text
> Perhaps this is related to RT #66031 ... please provide a .dia and a test and i can see if i understand your problem. We are only using uml-mode with many special cases, perhaps i can fix it for you (and me ;) ). >
Yes, this looks like a similar problem; unfortunatelly i don't have much time to reverse engineer the sources and make right patch. Please take a look at attachments in my first post. There're composition.dia source file and composition.sql output file. The command for execution also in my post. Should i provide something else ?
Subject: Re: [rt.cpan.org #91175] problem with processing of aggregation/composition in UML mode
Date: Wed, 18 Dec 2013 13:02:02 +0400
To: bug-Parse-Dia-SQL [...] rt.cpan.org
From: Andrej Shalaev <andrews [...] seventest.ru>
В Срд, 18/12/2013 в 03:11 -0500, Felix Antonius Wilhelm Ostmann via RT пишет: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=91175 > > Perhaps this is related to RT #66031 ... please provide a .dia and a test and i can see if i understand your problem. We are only using uml-mode with many special cases, perhaps i can fix it for you (and me ;) ). >
If it's needed, i will make a test some days later...
From: felix.ostmann [...] gmail.com
OK, i tested with your .dia-file ... the first thing: i think you have make the relationship wrong. You try to make a 1-n relation between from 'one' -> 'two' but you draw the line from 'two' -> 'one'. With the new version 0.26 and changing the direction of the link from A->B to B->A i get both ON CASCADE NULL/DELETE appended to the ALTER TABLE. Please try again in your time, but i think it is fixed :)
From: felix.ostmann [...] gmail.com
Am Mi 18. Dez 2013, 08:59:01, felix.ostmann@gmail.com schrieb: Show quoted text
> OK, i tested with your .dia-file ... > > the first thing: i think you have make the relationship wrong. > > You try to make a 1-n relation between from 'one' -> 'two' but you > draw the line from 'two' -> 'one'. > > With the new version 0.26 and changing the direction of the link from > A->B to B->A i get both ON CASCADE NULL/DELETE appended to the ALTER > TABLE. > > Please try again in your time, but i think it is fixed :)
Uh, my fault! After sleeping i checked again the documentation: http://tedia2sql.tigris.org/sampleImages/Association.png I think my last patch switched the direction from parent -> child, which is wrong ... can someone (maintainer) please check that again? I think in my last submitted test the link-direction between the tables is wrong.
Subject: Re: [rt.cpan.org #91175] problem with processing of aggregation/composition in UML mode
Date: Thu, 19 Dec 2013 13:09:32 +0400
To: bug-Parse-Dia-SQL [...] rt.cpan.org
From: Andrej Shalaev <andrews [...] seventest.ru>
Hello, В Чтв, 19/12/2013 в 03:47 -0500, Felix Antonius Wilhelm Ostmann via RT пишет: Show quoted text
> Uh, my fault! After sleeping i checked again the documentation: > > http://tedia2sql.tigris.org/sampleImages/Association.png > > I think my last patch switched the direction from parent -> child, which is wrong ... can someone (maintainer) please check that again? I think in my last submitted test the link-direction between the tables is wrong. >
In my opinion, it shouldn't matter how i place association in Dia. It should matter which Direction i choose from association's properties. If it's "From A to B" then 1-side must be A, if it's "From B to A" then 1-side must be B. Of course if Type is composition or aggregation. PS. 0.26 version works for B->A direction only. A->B direction gives strange error and doesn't work =)
From: felix.ostmann [...] gmail.com
Am Do 19. Dez 2013, 04:09:54, andrews@seventest.ru schrieb: Show quoted text
> Hello, > > В Чтв, 19/12/2013 в 03:47 -0500, Felix Antonius Wilhelm Ostmann via RT > пишет:
> > Uh, my fault! After sleeping i checked again the documentation: > > > > http://tedia2sql.tigris.org/sampleImages/Association.png > > > > I think my last patch switched the direction from parent -> child, > > which is wrong ... can someone (maintainer) please check that again? > > I think in my last submitted test the link-direction between the > > tables is wrong. > >
> > In my opinion, it shouldn't matter how i place association in Dia. It > should matter which Direction i choose from association's properties. > If > it's "From A to B" then 1-side must be A, if it's "From B to A" then > 1-side must be B. Of course if Type is composition or aggregation. > > PS. 0.26 version works for B->A direction only. A->B direction gives > strange error and doesn't work =)
Please read the strange error ;) There should something like: primary or unique key missing, which is the correct way to tell you, that when you change the direction it cannot build the desired relationship without such a key. 1->n without a primary key or unique key on the 1-site is simple not valid. So the only question is: Which is the correct direction: 1->n means A->B or B->A? Please check against the image i provided earlier.
Subject: Re: [rt.cpan.org #91175] problem with processing of aggregation/composition in UML mode
Date: Mon, 30 Dec 2013 16:33:00 +0400
To: bug-Parse-Dia-SQL [...] rt.cpan.org
From: Andrej Shalaev <andrews [...] seventest.ru>
В Вск, 22/12/2013 в 06:05 -0500, Felix Antonius Wilhelm Ostmann via RT пишет: Show quoted text
> Please read the strange error ;) There should something like: primary or unique key missing, which is the correct way to tell you, that when you change the direction it cannot build the desired relationship without such a key. >
The strange error (actually warning) is: [WARN] In association compose one_id doesn't refer to a primary key or unique index But it's not true, because 'one_id' refers to 'id' on other side and 'id' IS A primary key! Show quoted text
> 1->n without a primary key or unique key on the 1-site is simple not valid. >
agreed. Show quoted text
> So the only question is: Which is the correct direction: 1->n means A->B or B->A? Please check against the image i provided earlier. >
Maybe i'm wrong, but image (read - diagram) can not say us - which Direction we did choose for aggregation/composition - A->B or B->A. According Dia's conception, "rhombus" is always on "From" side. "Rhombus" is a "Whole", that means 1-side. Opposite side is a "Part", that means n-side. That's why i'm still keeping my opinion that we must take attention on what is "From" side - A or B. PS. Being guided by convenience reasons
Subject: Re: [rt.cpan.org #91175] problem with processing of aggregation/composition in UML mode
Date: Mon, 30 Dec 2013 16:46:58 +0400
To: bug-Parse-Dia-SQL [...] rt.cpan.org
From: Andrej Shalaev <andrews [...] seventest.ru>
... PS. Being guided by convenience reasons the A->B way is most convenient for use =) But, as i earlier said, it's wrong decision IMHO.