Received: from www.actarg.com (root@[209.180.91.25]) by hub.org (8.9.3/8.9.3) with ESMTP id LAA09929; Wed, 8 Mar 2000 11:19:56 -0500 (EST) (envelope-from kyle@actarg.com) Received: from actarg.com (root@tao.actarg.com [192.168.2.1]) by www.actarg.com (8.8.7/8.8.7) with ESMTP id JAA31517; Wed, 8 Mar 2000 09:20:01 -0700 Received: from actarg.com (kyle@chi.actarg.com [192.168.2.16]) by actarg.com (8.8.7/8.8.7) with ESMTP id JAA22676; Wed, 8 Mar 2000 09:17:07 -0700 Sender: kyle@actarg.com Message-ID: <38C67E39.DA7EE8A5@actarg.com> Date: Wed, 08 Mar 2000 09:22:17 -0700 From: Kyle Bateman Organization: Action Target Inc X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.0.36 i686) X-Accept-Language: en MIME-Version: 1.0 To: Tom Lane CC: pgsql-sql@postgreSQL.org, pgsql-hackers@postgreSQL.org Subject: Re: Casts in 7.0 vs 6.5 (was Re: [SQL] 7.0beta bug (or feature)?) References: <38C0022D.B30A7536@actarg.com> <22705.952473593@sss.pgh.pa.us> Content-Type: multipart/mixed; boundary="------------162D10C4F2EDC56708CB7589" This is a multi-part message in MIME format. --------------162D10C4F2EDC56708CB7589 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Tom Lane wrote: > > I am not sure whether this should be regarded as a bug or a feature. > On the one hand you could argue that ambiguous casts are a bad thing, > but on the other hand, if text(foo) works, why shouldn't foo::text work? > > One thing to realize while considering whether to change this is that if > we generalize the behavior of casts, we may also affect the behavior of > implicit casts, such as the one applied to convert supplied data in an > INSERT or UPDATE to the target column type. This could result in loss > of error detection capability. Currently, both 6.5 and 7.0 do this: > > regression=# create table foo(f1 text); > CREATE > regression=# insert into foo values('now'::date); > ERROR: Attribute 'f1' is of type 'text' but expression is of type 'date' > You will need to rewrite or cast the expression > > but if we allow datevalue::text to work, then (barring still more > pushups in the code) the above will be accepted. Should it be? > > Comments anyone? > What if you could to a "set AutoCasting=yes" just as you might set the datestyle variable. Then the DBA could decide whether type mismatches should be quitely translated or reported? --------------162D10C4F2EDC56708CB7589 Content-Type: text/x-vcard; charset=us-ascii; name="kyle.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Kyle Bateman Content-Disposition: attachment; filename="kyle.vcf" begin:vcard n:Bateman;Kyle tel;fax:801-377-8096 tel;work:801-377-8033x101 x-mozilla-html:FALSE url:www.actiontarget.com org:Action Target Inc adr:;;PO Box 636;Provo;UT;84603;US version:2.1 email;internet:kyle@actiontarget.com title:President x-mozilla-cpt:;-15520 fn:Kyle Bateman end:vcard --------------162D10C4F2EDC56708CB7589--