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);
> 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?
Description: text/x-vcard (291 bytes)
In response to
pgsql-hackers by date
|Next:||From: Karel Zak - Zakkr||Date: 2000-03-08 16:26:14|
|Subject: regex (from TODO)|
|Previous:||From: Tom Lane||Date: 2000-03-08 16:15:56|
|Subject: Re: [HACKERS] DROP TABLE inside a transaction block |
pgsql-sql by date
|Next:||From: Matthew Hagerty||Date: 2000-03-08 20:00:06|
|Subject: END or COMMIT?|
|Previous:||From: Tom Lane||Date: 2000-03-08 16:04:37|
|Subject: Re: FW: [SQL] Errors loading null dates in 7.0beta1 |