Re: [HACKERS] Automatic type conversion

From: dg(at)illustra(dot)com (David Gould)
To: lockhart(at)alumni(dot)caltech(dot)edu (Thomas G(dot) Lockhart)
Cc: dchapes(at)ddm(dot)on(dot)ca, hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Automatic type conversion
Date: 1998-05-11 18:33:44
Message-ID: 9805111833.AA13947@hawk.illustra.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom:
> One way to address this is to never allow Postgres to "demote" a type;
> i.e. Postgres would be allowed to promote arguments to a "higher" type
> (e.g. int->float) but never allowed to demote arguments (e.g.
> float->int). But this would severely restrict type matching. I wanted to
> try the more flexible case first to see whether it really does the
> "wrong thing"; in the case of factorial, the only recourse for someone
> wanting to calculate a factorial from a float is to convert to an int
> first anyway.

I think that never demoting is the best way to procede here. If the type
resolution search is too "thorough" it can be very confusing (see c++ for
example). As it is the interaction of SQL and the type system can create
surprises. Promoting both "up" and "down" is likely to make it very hard
to figure out what any given query will do.

-dg

David Gould dg(at)illustra(dot)com 510.628.3783 or 510.305.9468
Informix Software (No, really) 300 Lakeside Drive Oakland, CA 94612
"Of course, someone who knows more about this will correct me if I'm wrong,
and someone who knows less will correct me if I'm right."
--David Palmer (palmer(at)tybalt(dot)caltech(dot)edu)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Byron Nikolaidis 1998-05-11 18:42:16 Re: [INTERFACES] Re: NEW ODBC DRIVER
Previous Message Jose' Soares Da Silva 1998-05-11 17:38:33 Re: [QUESTIONS] money or dollar type