From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Thomas Lockhart <lockhart(at)fourpalms(dot)org> |
Cc: | Barry Lind <barry(at)xythos(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Implicit coercions need to be reined in |
Date: | 2002-04-11 20:23:30 |
Message-ID: | 17967.1018556610@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Since it seems we still want to debate this a little, I've modified the
initial set of implicit-coercion-allowed flags to allow silent coercions
from the standard datatypes to text. This un-breaks most of the
regression tests that were failing before. I still want to debate the
wisdom of allowing this, but there's no point in changing the regress
tests until we're agreed.
An interesting breakage that remained was that the foreign_key tests
were assuming a "text = integer" comparison would fail, while a
"varchar = integer" comparison would succeed ... which is not only
pretty bogus in itself, but becomes even more so when you notice that
there isn't a varchar = integer operator. Apparently, because we had
implicit coercions in *both* directions between text and integer,
the system couldn't figure out how to resolve text = integer; but
since there was an int->varchar and no varchar->int coercion, it
would resolve varchar = integer as varchar = integer::varchar.
With the attached settings, both cases are accepted as doing text =
int::text. I'm not convinced that this is a step forward; I'd prefer
to see explicit coercion needed to cross type categories. But that's
the matter for debate.
The lines marked XXX are the ones that I enabled since yesterday, and
would like to disable again:
implicit | result | input | prosrc
----------+-------------+-------------+--------------------------------------
no | abstime | timestamp | timestamp_abstime
no | abstime | timestamptz | timestamptz_abstime
no | box | circle | circle_box
no | box | polygon | poly_box
yes | bpchar | char | char_bpchar
yes | bpchar | name | name_bpchar
yes | char | text | text_char
no | cidr | text | text_cidr
no | circle | box | box_circle
no | circle | polygon | poly_circle
no | date | abstime | abstime_date
no | date | text | text_date
no | date | timestamp | timestamp_date
no | date | timestamptz | timestamptz_date
yes | float4 | float8 | dtof
yes | float4 | int2 | i2tof
yes | float4 | int4 | i4tof
no | float4 | numeric | numeric_float4
no | float4 | text | text_float4
yes | float8 | float4 | ftod
yes | float8 | int2 | i2tod
yes | float8 | int4 | i4tod
yes | float8 | int8 | i8tod
no | float8 | numeric | numeric_float8
no | float8 | text | text_float8
no | inet | text | text_inet
no | int2 | float4 | ftoi2
no | int2 | float8 | dtoi2
yes | int2 | int4 | i4toi2
yes | int2 | int8 | int82
no | int2 | numeric | numeric_int2
no | int2 | text | text_int2
no | int4 | float4 | ftoi4
no | int4 | float8 | dtoi4
yes | int4 | int2 | i2toi4
yes | int4 | int8 | int84
no | int4 | numeric | numeric_int4
no | int4 | text | text_int4
no | int8 | float8 | dtoi8
yes | int8 | int2 | int28
yes | int8 | int4 | int48
no | int8 | numeric | numeric_int8
no | int8 | text | text_int8
yes | interval | reltime | reltime_interval
no | interval | text | text_interval
yes | interval | time | time_interval
no | lseg | box | box_diagonal
no | macaddr | text | text_macaddr
yes | name | bpchar | bpchar_name
yes | name | text | text_name
yes | name | varchar | text_name
yes | numeric | float4 | float4_numeric
yes | numeric | float8 | float8_numeric
yes | numeric | int2 | int2_numeric
yes | numeric | int4 | int4_numeric
yes | numeric | int8 | int8_numeric
no | oid | text | text_oid
no | path | polygon | poly_path
no | point | box | box_center
no | point | circle | circle_center
no | point | lseg | lseg_center
no | point | path | path_center
no | point | polygon | poly_center
no | polygon | box | box_poly
no | polygon | circle | select polygon(12, $1)
no | polygon | path | path_poly
no | reltime | int4 | int4reltime
no | reltime | interval | interval_reltime
yes | text | char | char_text
XXX | text | date | date_text
XXX | text | float4 | float4_text
XXX | text | float8 | float8_text
no | text | inet | network_show
XXX | text | int2 | int2_text
XXX | text | int4 | int4_text
XXX | text | int8 | int8_text
XXX | text | interval | interval_text
no | text | macaddr | macaddr_text
yes | text | name | name_text
no | text | oid | oid_text
XXX | text | time | time_text
XXX | text | timestamp | timestamp_text
XXX | text | timestamptz | timestamptz_text
XXX | text | timetz | timetz_text
no | time | abstime | select time(cast($1 as timestamp without time zone))
no | time | interval | interval_time
no | time | text | text_time
no | time | timestamp | timestamp_time
yes | time | timetz | timetz_time
yes | timestamp | abstime | abstime_timestamp
yes | timestamp | date | date_timestamp
no | timestamp | text | text_timestamp
yes | timestamp | timestamptz | timestamptz_timestamp
yes | timestamptz | abstime | abstime_timestamptz
yes | timestamptz | date | date_timestamptz
no | timestamptz | text | text_timestamptz
yes | timestamptz | timestamp | timestamp_timestamptz
no | timetz | text | text_timetz
yes | timetz | time | time_timetz
no | timetz | timestamptz | timestamptz_timetz
no | varchar | int4 | int4_text
no | varchar | int8 | int8_text
yes | varchar | name | name_text
(103 rows)
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-04-11 20:48:43 | Re: 7.3 schedule |
Previous Message | Dave Page | 2002-04-11 19:29:55 | Re: migration problem |