Re: upgrading postgresql broke some queries

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: upgrading postgresql broke some queries
Дата
Msg-id dcc563d10908041223q6b5f3ffpba088e93e21c9761@mail.gmail.com
обсуждение исходный текст
Ответ на upgrading postgresql broke some queries  (Aras Angelo <araskoktas@gmail.com>)
Список pgsql-admin
On Tue, Aug 4, 2009 at 1:02 PM, Aras Angelo<araskoktas@gmail.com> wrote:
> Hi All,
>
> I recently upgraded my box to the latest version. The  previous one was a
> bit outdated. Apparently we have some bad structure formatting in our db
> design, cause the latest version broke our software. The issue is some
> character varying fields are used in queries joining to integers. The old db
> server was just allowing us to join INT to CHAR. Now its not. I researched
> on some ways to fix this, i can do CAST(field AS text) in my queries, but
> there are dozens and they are hard to find.
>
> I was wondering if there is an easy global solution for this. I cant just
> alter the CHAR fields to INT because some rows have empty values. I can just
> change them to 'zero' and alter type to integer but im worried i can lose
> some functionality because some queries again is looking for empty value.

Your schema is broken, and you need to rethink what those fields meant
and what they should really mean.  As Devrim mentions you can regain
the lost casts (mostly) but the better answer is to fix your schema
and fix your data.  If a field should be an int, then make it an int,
not a text parading around as a sort of int.  We had a similar issue
show up in our migration, and we found and fixed all the instances in
an afternoon of hacking.  The work you put into fixing your schema and
data today will save you much work tomorrow and the next day.

В списке pgsql-admin по дате отправления:

Предыдущее
От: Devrim GÜNDÜZ
Дата:
Сообщение: Re: upgrading postgresql broke some queries
Следующее
От: "Plugge, Joe R."
Дата:
Сообщение: Slony-I Version 2.0.3RC with Postgres 8.4.0