Re: Trying to create implicit casts to text in PG 8.3

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Trying to create implicit casts to text in PG 8.3
Date: 2009-01-13 16:58:08
Message-ID: 20090113165808.GK3008@frubble.xen.chris-lamb.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Emanuel Calvo Franco 2009-01-13 17:02:20 Re: Cast for text->Integer missing in 8.3.5
Previous Message Aleksander Kmetec 2009-01-13 16:51:32 Re: Cast for text->Integer missing in 8.3.5