Re: int or integer ?

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

Parent Message unknown Re: int or integer ?

by Mike Ginou :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Massimiliano,

I see the problem, however, since int and integer are synonyms according
to the PostgreSQL manual. Therefore I cannot make the simple change that
you describe. To do so would mean that others who use 'int' rather than
'integer' in their classes will encounter the same problem.

I investigated making changes to the function that determines type
mismatches for associations, however the change would be complex and is
generally beyond the type of maintenance work that is done for this project.

If you would like to work on it and submit a change, I would be happy to
review it. The relevant subroutine is generateOneToAnyAssociation (there
may be some other subroutines that require modification as well). What
would be required is to parse out the attributes of the association and
rather than simply comparing them directly, a new comparison function
would be needed. The comparison function would allow for any special
case comparisons to be made. In the case of most DBs (and in your
particular example, postgres) int is a synonym for integer thus an
association with int on one side and integer on the other would be
considered a match.

-Mike


Massimiliano Franco wrote:

> Hello,
>
> I created a quick Gentoo ebuild to test the latest CVS version of
> tedia2sql.
>
> I'm using the 'postgres' DB and I encountered a problem with relations
> between tables when in the first table I have an entry with a serial
> type and in the second I have an integer type.
>
> I noticed that the 1.66 revision introduces a treatment on the serial
> type:
> ***********************
> + # Returns base type of some DMBS specyfic types (eg in PostgreSQL
> serial is int)
> + sub getBaseType($) {
> +       my $typeName    = shift;
> +       if ($opt_t eq 'postgres') {
> +               if ($typeName eq 'serial' || $typeName eq 'SERIAL') {
> +                       return 'int';
> +               }
> +       } else {
> +               return $typeName;
> +       }
> + }
> ***********************
> It's the "return 'int'" that annoys me. Since this revision the script
> exits with this kind of error:
> Attribute types (id_client is serial, id_client is integer) don't match
> in clientsCli_con (clients,cli_con)
> Number or types of (id_client) don't match (id_client) in clientsCli_con
>
> I suggest replacing "return 'int'" to "return 'integer'" as the mapping
> is already handled. I don't know if it breaks other things.
>
> Thanks for your time.
>
> Have a nice day !
>
> Massimo
>
>

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


Re: Re: int or integer ?

by Massimiliano Franco-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Mike,

Thanks for you answer. I was sure you would propose me to code a
function :) That was the solution I had in mind to resolve this matter.
I may perhaps have the time in the next months. I let you know.

About this integer/int thing, if 'int' is "the way", then it should at
least be mentioned somehow in the documentation page :
http://tedia2sql.tigris.org/usingtedia2sql.html

There's some examples talking about using 'integer'.

Just my 2cts.

Massimiliano

Le mardi 24 avril 2007 à 10:17 -0400, Mike Ginou a écrit :

> Massimiliano,
>
> I see the problem, however, since int and integer are synonyms according
> to the PostgreSQL manual. Therefore I cannot make the simple change that
> you describe. To do so would mean that others who use 'int' rather than
> 'integer' in their classes will encounter the same problem.
>
> I investigated making changes to the function that determines type
> mismatches for associations, however the change would be complex and is
> generally beyond the type of maintenance work that is done for this project.
>
> If you would like to work on it and submit a change, I would be happy to
> review it. The relevant subroutine is generateOneToAnyAssociation (there
> may be some other subroutines that require modification as well). What
> would be required is to parse out the attributes of the association and
> rather than simply comparing them directly, a new comparison function
> would be needed. The comparison function would allow for any special
> case comparisons to be made. In the case of most DBs (and in your
> particular example, postgres) int is a synonym for integer thus an
> association with int on one side and integer on the other would be
> considered a match.
>
> -Mike
>
>
> Massimiliano Franco wrote:
> > Hello,
> >
> > I created a quick Gentoo ebuild to test the latest CVS version of
> > tedia2sql.
> >
> > I'm using the 'postgres' DB and I encountered a problem with relations
> > between tables when in the first table I have an entry with a serial
> > type and in the second I have an integer type.
> >
> > I noticed that the 1.66 revision introduces a treatment on the serial
> > type:
> > ***********************
> > + # Returns base type of some DMBS specyfic types (eg in PostgreSQL
> > serial is int)
> > + sub getBaseType($) {
> > +       my $typeName    = shift;
> > +       if ($opt_t eq 'postgres') {
> > +               if ($typeName eq 'serial' || $typeName eq 'SERIAL') {
> > +                       return 'int';
> > +               }
> > +       } else {
> > +               return $typeName;
> > +       }
> > + }
> > ***********************
> > It's the "return 'int'" that annoys me. Since this revision the script
> > exits with this kind of error:
> > Attribute types (id_client is serial, id_client is integer) don't match
> > in clientsCli_con (clients,cli_con)
> > Number or types of (id_client) don't match (id_client) in clientsCli_con
> >
> > I suggest replacing "return 'int'" to "return 'integer'" as the mapping
> > is already handled. I don't know if it breaks other things.
> >
> > Thanks for your time.
> >
> > Have a nice day !
> >
> > Massimo
> >
> >
>
> ---------------------------------------------------------------------
> 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: Re: int or integer ?

by Mike Ginou :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> About this integer/int thing, if 'int' is "the way", then it should at
> least be mentioned somehow in the documentation page :
> http://tedia2sql.tigris.org/usingtedia2sql.html
>
> There's some examples talking about using 'integer'.

Yes, you're absolutely right. I'll put it on my list of things to do.
I'm not very fast at getting to them though :)

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


Re: Re: int or integer ?

by Time Less :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 4/26/07, Mike Ginou <mike@...> wrote:
> About this integer/int thing, if 'int' is "the way", then it should at
> least be mentioned somehow in the documentation page :
> http://tedia2sql.tigris.org/usingtedia2sql.html
>
> There's some examples talking about using 'integer'.

Yes, you're absolutely right. I'll put it on my list of things to do.
I'm not very fast at getting to them though :)

I don't think I'm fully understanding the issues with 'int' vs 'integer' here, but since we seem happy to refer to it as 'int' on the docs page as resolving the issue, I edited the docs and checked them in. The page now refers to 'int' rather than 'integer.'

--
timeless(ness)


Re: Re: int or integer ?

by Massimiliano Franco :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I was using "integer" in my dia schema and the script was working fine
until I tried the last CVS version.

The "problem" with using "integer" is that type compatibility checks
fails comparing "serial <=> integer" on a relation,  but works on
"serial <=> int" (check revision 1.65 on CVS).

The script *should* accept both of them as both are documented in
postgresql... But let say it would be a new feature for a release on a
galaxy far far away ;) The modif on the doc is well enough. I changed my
schema.

Thanks to both of you, timeless, Mike.

Have a nice week-end.

Massimiliano

Le jeudi 26 avril 2007 à 14:49 -0700, Time Less a écrit :

> On 4/26/07, Mike Ginou <mike@...> wrote:
>         > About this integer/int thing, if 'int' is "the way", then it
>         should at
>         > least be mentioned somehow in the documentation page :
>         > http://tedia2sql.tigris.org/usingtedia2sql.html
>         >
>         > There's some examples talking about using 'integer'.
>        
>         Yes, you're absolutely right. I'll put it on my list of things
>         to do.
>         I'm not very fast at getting to them though :)
>
> I don't think I'm fully understanding the issues with 'int' vs
> 'integer' here, but since we seem happy to refer to it as 'int' on the
> docs page as resolving the issue, I edited the docs and checked them
> in. The page now refers to 'int' rather than 'integer.'
>
> --
> timeless(ness)
>

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

LightInTheBox - Buy quality products at wholesale price