Friday, February 1, 2013

What's wrong with this postgreSQL

Recently I've stumbled upon a little problem with postgresql. I was working on a simple qt utility that would check if data is being continuously entered in one of the databases. So I set up a max time query and see if everything is fine.
For normal scenarios the application worked fine. Then I started testing it for fail cases and there I observed a peculiar case. I truncated the respective table and wanted to see if my app would raise any exception or handle the situation. Funnily though I found out that my app was fetching data from a database that was seemingly empty.
I was genuinely puzzled. I had truncated the table. Then I ran VACUUM on the table just to be sure.
But the result was same. I restarted the server and tried the same situation. But result the same. Then I modified the database connection in the app and used my PC's IP 192.168.blah.blah. And I reran the app. Funnily enough the app stopped showing the ghost data and things worked out. I wondered what the hell.
Later I was testing this in live environment - this being small utility and all. There though the PC's actual IP didn't work and I had to use 127.0.0.1.
So I knew something is screwed up at my end. So I start pgadmin III and try to connect to 127.0.0.1 and it connects and it even shows me the ghost data. Gods!
I wonder and dig up the net trying to find out what the hell is wrong with my code. Or my postgreSQL server.
I'm still wondering...

No comments:

Post a Comment