Implicit CAST is not working in Postgresql 8.4
I migrated data from Postgresql 8.1 to Postgresql 8.4 using pg_dump.
But now I found that, most of the queries in my applicaiton are being
failed. Invesitigating the problem, I found that no function is available in
the DB to CAST INT to TEXT etc.
Most of the queries are failed because implicit cast is not working
properly.
Any idea how to solve it.
On 28 September 2010 07:37, AI Rumman <rummandba@gmail.com> wrote:
I migrated data from Postgresql 8.1 to Postgresql 8.4 using pg_dump.
But now I found that, most of the queries in my applicaiton are being
failed. Invesitigating the problem, I found that no function is available in
the DB to CAST INT to TEXT etc.
Most of the queries are failed because implicit cast is not working
properly.
Any idea how to solve it.
As of 8.3 non-text types don't automatically cast to text. You'll
need to use a cast.
So:
WHERE my_int_col = my_text_col
becomes
WHERE my_int_col::text = my_text_col
Regards
--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935
Hello
see http://petereisentraut.blogspot.com/2008/03/readding-implicit-casts-in-postgresql.html
Regards
Pavel Stehule
2010/9/28 AI Rumman <rummandba@gmail.com>:
Show quoted text
I migrated data from Postgresql 8.1 to Postgresql 8.4 using pg_dump.
But now I found that, most of the queries in my applicaiton are being
failed. Invesitigating the problem, I found that no function is available in
the DB to CAST INT to TEXT etc.
Most of the queries are failed because implicit cast is not working
properly.
Any idea how to solve it.
On Tue, Sep 28, 2010 at 12:37:46PM +0600, AI Rumman wrote:
I migrated data from Postgresql 8.1 to Postgresql 8.4 using
pg_dump. But now I found that, most of the queries in my
applicaiton are being failed. Invesitigating the problem, I found
that no function is available in the DB to CAST INT to TEXT etc.
This is due to sloppy coding in your code base, which was, unknown to
you, capable of producing "surprising," and by "surprising," I mean
"glaringly wrong" answers. You need to find the places where your
code base contains this slop and clean it up.
I can't really recommend that you put in workarounds, as they don't
actually fix the bugs you've found.
Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate