Hello!

On Friday 25 September 2009 22:29:55 Tom Jackson wrote:
> Personally I would use [string is double -strict] and quote anything

Tcl and PostgreSQL types are not equal.

tclsh8.5 [/tmp]string is double -strict 9999999999
1
template1=# create temp table test(value integer);
CREATE TABLE
template1=# insert into test (999999999999999999999);
template1=# insert into test values (9999999999);
ERROR:  integer overflow

So you send to PostgreSQL overflowed values without strict typing
which are potentially dangerous. Defaults type conversions in 
PostgreSQL depends of version and so application behaviour is
undefined with other PostgreSQL version.

Database and application can be placed on hosts with different
arch (32 and 64 bit). In this case you can't check integer type size 
in application because database can have the different type size.

On Friday 25 September 2009 22:29:55 Tom Jackson wrote:
>  What
> is better is a type system which handles each type in a separate API
> and rejects unfound types. 

The better is mapping in the driver and DBMS with dynamic typing. As
example for SQLite (the forms $value and :value are equal):

db eval {create table test(value int)}
db eval {insert into test (value) values (999999999999999999999)}
insert into test (value) values (9999999999.999999)

set value 1
db eval {insert into test (value) values ($value)}
set value {The test value with '}
db eval {insert into test (value) values (:value)}

sqlite> select typeof(value),value from test;
real|1.0e+21
real|10000000000.0
integer|1
text|The test value with '

And strict field typing can be released by constraints or triggers or 
collations.

Best regards, Alexey Pechnikov.
http://pechnikov.tel/


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to 
<lists...@listserv.aol.com> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to