Re: Trying to create implicit casts to text in PG 8.3 - Mailing list pgsql-general

From Sam Mason
Subject Re: Trying to create implicit casts to text in PG 8.3
Date
Msg-id 20090113165808.GK3008@frubble.xen.chris-lamb.co.uk
Whole thread Raw
In response to Re: Trying to create implicit casts to text in PG 8.3  (Aleksander Kmetec <aleksander.kmetec@intera.si>)
Responses Re: Trying to create implicit casts to text in PG 8.3
List pgsql-general
On Tue, Jan 13, 2009 at 05:43:52PM +0100, Aleksander Kmetec wrote:
> I added both "||(double precision, text)" and "||(text, double
> precision)" operators and it works now.
>
> But I'm wondering: do I need to do anything else besides creating implicit
> casts and adding missing operators? And will this introduce any side
> effects which are not compatible with 8.2 and might break my queries in
> unpredictable ways?

You'll get less errors from PG because you've told it to convert things
automatically for you.  I'd be tempted to not do this and change the
code to make these conversion explicit as there will be cases (maybe
when you're writing code in the future) when you want to get an error
and not have PG do something unexpected.

In the end, any type system is just a tool.  It's main job is to find
bugs in code by spotting a common class of error (it also allows other
optimizations, but that's normally less important).  I tend to find it
serves a useful purpose and the errors it gives are indications for me
to be more explicit with my code.  If you find it's too strict you're free
to disable it by adding in extra casts/functions/operators.


  Sam

pgsql-general by date:

Previous
From: Aleksander Kmetec
Date:
Subject: Re: Cast for text->Integer missing in 8.3.5
Next
From: Emanuel Calvo Franco
Date:
Subject: Re: Cast for text->Integer missing in 8.3.5