Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql General > Re: operator va...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 9 of 21 Topic 15458 of 17598
Post > Topic >>

Re: operator varchar = integer

by Daniel Schuchardt <daniel_schuchardt@[EMAIL PROTECTED] > May 5, 2008 at 09:04 PM

Tom Lane schrieb:
> David Fetter <david@[EMAIL PROTECTED]
> writes:
>   
>> On Mon, May 05, 2008 at 05:26:40PM +0200, Daniel Schuchardt wrote:
>>     
>>> our db has about 500 functions, 300 tables, 1000 indexes, 1200 Views
>>> that all use implicit casting.  and: everything is working fine ;-)
>>> :-P
>>>       
>
>   
>> How do you know?  8.3 removed the implicit casts precisely because
>> they were producing results that could most generously be describe as
>> "surprising."
>>     
>
> This should not be underestimated.  From the re****ts we've seen so far,
> a very sizable fraction of people who find this kind of failure with 8.3
> find out that their application was doing something unexpected in the
> cases where it happened.  If you've got as many failures as you suggest,
> I'd be willing to bet that some of them are bugs in your code, not just
> reliance on an implicit feature.
>
> 			regards, tom lane
>
>   
yes true your right but lets make a calculation:

our application runs about 6 Years now so lets say there are 5% queries 
that run still in a mistake caus of auto cast.
We have to check about 1200 views, 500 functions, every runtime created 
query and so on. Lets say 95% of them run fine now. Now lets think we 
check and rewrite all of them. If you let out the time (our customers 
wont pay for such changes, they will have more errors the first time 
than the last years), we should expect about X % errors because of the 
changes (wrong parantheses and so on). So it would be a horror for us.
thats the problem.

examples:

RAISE EXCEPTION "error during validation % :", 
'ks:"'||ks||'"@[EMAIL PROTECTED]
"'||loopdate||'"';  (KS is DECLARED VARCHAR, LoopDate is 
a TIMESTAMP);

stempz:=Round(SUM(COALESCE(ba_efftime, timediff(ba_anf, CAST(now() AS 
TIMESTAMP(0) WITHOUT TIME ZONE))))) FROM bdea WHERE 
timestamp_to_date(ba_anf)=current_date AND ba_ks=oks AND 
*ba_ix||'~'||ba_op* IN (SELECT *a2_ab_ix||'~'||a2_n* FROM ab2_wkstplan 
JOIN ab2 ON a2_id=a2w_a2_id WHERE a2w_oks=oks AND a2w_ks=ks AND 
a2w_planweek=week);

this are integer fields. but they are unique with "*a2_ab_ix||'~'||a2_n*".

another one:

here we need to add 4 CASTS.
CREATE OR REPLACE FUNCTION date_to_yearmonth_dec(TIMESTAMP) RETURNS 
INTEGER AS $$
DECLARE R INTEGER;
BEGIN
 IF extract(month FROM $1)<11 THEN
     R:=extract(year FROM $1)||0||extract(month FROM $1)-1;
 ELSE
     R:=extract(year FROM $1)||extract(month FROM $1)-1;
 END IF;
 RETURN  R;
END$$LANGUAGE plpgsql IMMUTABLE;
 




 21 Posts in Topic:
operator varchar = integer
Daniel Schuchardt <dan  2008-05-05 11:18:37 
Re: operator varchar = integer
Daniel Schuchardt <dan  2008-05-05 12:55:25 
Re: operator varchar = integer
laurenz.albe@[EMAIL PROTE  2008-05-05 14:44:02 
Re: operator varchar = integer
david@[EMAIL PROTECTED]   2008-05-05 07:33:30 
Re: operator varchar = integer
Daniel Schuchardt <dan  2008-05-05 17:26:40 
Re: operator varchar = integer
david@[EMAIL PROTECTED]   2008-05-05 08:52:54 
Re: operator varchar = integer
Daniel Schuchardt <dan  2008-05-05 18:53:20 
Re: operator varchar = integer
tgl@[EMAIL PROTECTED] (T  2008-05-05 13:36:01 
Re: operator varchar = integer
Daniel Schuchardt <dan  2008-05-05 21:04:41 
Re: operator varchar = integer
Daniel Schuchardt <dan  2008-05-05 18:32:37 
operator is not unique: integer || integer
Daniel Schuchardt <dan  2008-05-05 18:43:37 
Re: operator is not unique: integer || integer
Daniel Schuchardt <dan  2008-05-05 20:54:07 
Re: operator is not unique: integer || integer
daniel_schuchardt@[EMAIL   2008-05-05 21:36:51 
Re: operator is not unique: integer || integer
kgore4@[EMAIL PROTECTED]   2008-05-06 10:05:18 
Re: operator is not unique: integer || integer
Daniel Schuchardt <dan  2008-05-06 10:08:06 
Re: operator is not unique: integer || integer
dalroi@[EMAIL PROTECTED]   2008-05-06 08:36:46 
Re: operator is not unique: integer || integer
Daniel Schuchardt <dan  2008-05-06 10:33:37 
now i'm really confused. insert/update does autocast, where some
Daniel Schuchardt <dan  2008-05-06 11:31:55 
Re: now i'm really confused. insert/update does autocast, where
Daniel Schuchardt <dan  2008-05-06 11:56:17 
Re: now i'm really confused. insert/update does autocast, where
kleptog@[EMAIL PROTECTED]  2008-05-06 13:16:30 
Re: now i'm really confused. insert/update does autocast, where
peter_e@[EMAIL PROTECTED]  2008-05-08 17:26:17 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 8:33:38 CST 2008.