Tom Lane writes:

> I've noticed in other cases that it's willing to do implicit
> conversion to text from practically anything.  That strikes me as a
> bug, or at least pretty darn unintuitive.  Is this behavior
> intentional, and if so what's the rationale?

Well, I'm sure you know my stance on these things by now, but let me add
one last thing: What I'm missing from the type system is a governing
strategy. On the one hand there is strong typing, on the other hand
implicit casting across the board, but not when you would actually want
it. This is usually where programming language paradigms clash, but note
that programming language design in the last two decades has clearly been
moving to one of two things: either strong and strict typing or no typing
at all. I'm not saying I like strict like Java were you can't pass a
literal `5' as a `short int' argument without complaints but strict as in
a string is a string, a date is a date, a point is a point, a number is a
number.

I would go as far as saying that if you try to insert a 5 in a text field
then this should be an error, you must write '5'. Surely some might claim
that this is an inconvenience. Indeed, this is inconveniencing me because
possible errors in string processing or even system logic are silently
dropped under the table. Nobody ever got carpal tunnel syndrome because of
two extra quotes, and if the SQL is machine-generated then fixing the
program is the best thing in the long run anyway.

The previous paragraph agrees with SQL (see section 9.2).


-- 
Peter Eisentraut                  Sernanders vï¿½g 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden


Mon, 15 May 2000 20:57:27 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re: Casting, again 
Your pg_excelencies,

Peter Eisentraut wrote:

> I would go as far as saying that if you try to insert a 5 in a text field
> then this should be an error, you must write '5'. Surely some might claim
> that this is an inconvenience. Indeed, this is inconveniencing me because
> possible errors in string processing or even system logic are silently
> dropped under the table. Nobody ever got carpal tunnel syndrome because of
> two extra quotes, and if the SQL is machine-generated then fixing the
> program is the best thing in the long run anyway.

Did you think to a system with some abstract types (like numeric, char, date,
etc.) and fizical
types within the abstract types (i.e. abstract numeric type holds physical
integer type, physical
float type, phisical numeric type), and the only implicit cast that parser
does to be
between phisical types whithin the same abstract type ?

Raul.





Wed, 17 May 2000 03:02:17 +0300
Raul Chirea <raul@brahms.ro>
Re: Casting, again