pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kyle Bateman <kyle@actarg.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgreSQL.org
Cc: pgsql-hackers@postgreSQL.org
Subject: Re: Casts in 7.0 vs 6.5 (was Re: [SQL] 7.0beta bug (or feature)?)
Date: Wed, 08 Mar 2000 09:22:17 -0700
Message-ID: <38C67E39.DA7EE8A5@actarg.com> (raw)
References: <38C0022D.B30A7536@actarg.com>
	<22705.952473593@sss.pgh.pa.us>

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?

Attachments:

kyle.vcf (text/x-vcard, 290B) download 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

view thread (2+ messages)

Message-ID: <38C67E39.DA7EE8A5@actarg.com>
Permalink:  ../38C67E39.DA7EE8A5@actarg.com/
Also on:    postgresql.org/message-id/38C67E39.DA7EE8A5@actarg.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: kyle@actarg.com, tgl@sss.pgh.pa.us, pgsql-hackers@postgreSQL.org
  Subject: Re: Casts in 7.0 vs 6.5 (was Re: [SQL] 7.0beta bug (or feature)?)
  In-Reply-To: <38C67E39.DA7EE8A5@actarg.com>
  References: <38C0022D.B30A7536@actarg.com> <22705.952473593@sss.pgh.pa.us> <38C67E39.DA7EE8A5@actarg.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox