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

Поиск
Список
Период
Сортировка
От Sam Mason
Тема Re: Trying to create implicit casts to text in PG 8.3
Дата
Msg-id 20090113165808.GK3008@frubble.xen.chris-lamb.co.uk
обсуждение исходный текст
Ответ на Re: Trying to create implicit casts to text in PG 8.3  (Aleksander Kmetec <aleksander.kmetec@intera.si>)
Ответы Re: Trying to create implicit casts to text in PG 8.3
Список 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 по дате отправления:

Предыдущее
От: Aleksander Kmetec
Дата:
Сообщение: Re: Cast for text->Integer missing in 8.3.5
Следующее
От: Emanuel Calvo Franco
Дата:
Сообщение: Re: Cast for text->Integer missing in 8.3.5