Book a Demo

Author Topic: Foreign key with columns of different types  (Read 3832 times)

Damir

  • EA User
  • **
  • Posts: 84
  • Karma: +0/-0
    • View Profile
Foreign key with columns of different types
« on: October 12, 2006, 02:47:59 am »
I have two tables. In Table A, PK is a column of type SERIAL. In Table B, is a FK column of type INTEGER. I need to model FK from table B to table A on these two columns. EA signals that columns must be of the same type for the FK. What to do? I don't see any workaround, except not model this FK as FK but "pretend" to model it through association standard attributes, without possibility to generate sql script from that ???.
Thanks.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Foreign key with columns of different types
« Reply #1 on: October 12, 2006, 02:54:15 am »
Hi Damir,

The reason EA is complaining is that it is (normally) a requirement within RDBMSs that the columns maintaining the relationship agree on both order and type.

What is your RDBMS technology?

What is the base type of the SERIAL datatype?

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Damir

  • EA User
  • **
  • Posts: 84
  • Karma: +0/-0
    • View Profile
Re: Foreign key with columns of different types
« Reply #2 on: October 12, 2006, 03:23:15 am »
Hi Paolo,
ofcourse

Informix, base type is the same - integer. (serial is just automatically generated integer)


damir

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Foreign key with columns of different types
« Reply #3 on: October 12, 2006, 03:45:49 am »
Quote
Hi Paolo,
of course

Informix, base type is the same - integer. (serial is just automatically generated integer)


damir
Since Informix is not one of the standard supported RDBMSs have you created all the necessary datatypes?  If you have and the Common type is the same, then it's likely to be a bug.  Report it.

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Damir

  • EA User
  • **
  • Posts: 84
  • Karma: +0/-0
    • View Profile
Re: Foreign key with columns of different types
« Reply #4 on: October 12, 2006, 05:12:53 am »
Hm, nice try. I've read all about the meaning of Common type for datatype and conclusion was that it's used in transformations. Nevertheless I changed serial datatype so that it has the same common type as integer. it still doesn't work. I'll report it to Sparxians.
thanks.