SylvainTI / wwwsqldesigner

Automatically exported from code.google.com/p/wwwsqldesigner
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Postgresql: serial/bigserial data types must be converted to integer/bigint in foreign keys #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. 'create foreign key' from a primary key of data type 'serial'
2.
3.

What is the expected output? What do you see instead?
the resultant foreign key is of data type serial. Should be 'integer' if
reference column is 'serial' or 'bigint' if reference column is 'bigserial'.

What version of the product are you using? On what operating system?
2.3.2 ubuntu 8.10

Please provide any additional information below.
This is a Postgresql related issue. Serial/bigserial are pseudo-types

Original issue reported on code.google.com by i...@amarosia.com on 23 Apr 2009 at 2:25

GoogleCodeExporter commented 9 years ago
Some Postgresql-related person must take care of this bug.

Original comment by ondrej.zara on 23 Apr 2009 at 9:44

GoogleCodeExporter commented 9 years ago
Where is this 'create foreign key' function in the code? Is it just a generic 
'make
foreign key type same as primary'? The application is aware of which database 
engine
is being used, since it uses the proper set of data types. Could there be an << 
IF
(engine is pgsql and primary type is serial) MAKE foreign key integer ELSE make
foreign key same as primary >> ?
The issue concerns Postgres users, but is an application issue.

Point me in the right direction and I may give it a go, but as a "jack of many
'languages' and master of none" it is difficult for me to grasp the overall 
workings
of the application.

Cheers :-)

Original comment by i...@amarosia.com on 23 Apr 2009 at 10:32

GoogleCodeExporter commented 9 years ago
It is architecturally incorrect to make such database-specific adjustments in a 
code
which is apriori DB agnostic.

On the other hand, I see that this could not be solved by means of 
modifications of
Postgresql datatypes definition. I will try to make up some solution here.

Original comment by ondrej.zara on 23 Apr 2009 at 11:27

GoogleCodeExporter commented 9 years ago
I have implemented this functionality. The datatypes.xml's <type> tag now has 
an optional fk attribute, which 
names the foreign key's type when given type is a primary key. Thus it's 
relatively DB agnostic. This functionality 
can be added for any database that requires it, simply by modifying the 
datatypes.xml file.

Original comment by ober.14@osu.edu on 8 Nov 2009 at 8:34

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for a patch, fixed in revision 60.

Original comment by ondrej.zara on 10 Nov 2009 at 1:32