I'm running into a very strange bug when using Postgresql using the Npgsql (2.0.11 and 2.0.11.94) DLL in .NET 3.5.
I've created a program that will run these two queries (these are copied directly from the programs output):
INSERT INTO "db_events" VALUES ('2','1','2','1', to_timestamp('2012/08/27 10:22:43', 'YYYY/MM/DD HH24:MI:SS'),'2012', '8', '27', '10', '22', '43', '35' );
INSERT INTO "db_events_counts" VALUES ('1','2', '0', '1', '0', '1' );
This program will run perfectly fine on Windows XP x86 with both postgres 8.4.12 and 9.0.9, and will enter the data into the tables as it should.
However, when running the exact same program on Windows 7 with a database that has been set up in an identical way to the Windows XP data base, I run into the error:
ERROR: 42P01: relation "db_events" does not exist
I have read that this error is because postgres is forcing table names to lowercase, which is fine since they are already. Or that a table created with quotes has to be referenced with quotes, which is also fine since I am using quotes.
In the windows 7 database, if i copy and paste these two queries into pgadmin, they work fine, no errors, this leads me to believe it's something to do with the DLL?
What doesn't make sense is this program working bug free on my Windows XP system while throwing this error constantly on Windows 7.
I also try a simple delete statement:
DELETE FROM "db_events"; DELETE FROM "db_events_counts";
But that also ends in the same error.
Is there anything I am missing? Does Npgsql need to be compiled in the same windows environment as it's run in? or is there some subtle difference between windows 7 and windows XP with postgres that I am not getting.
Any help or information on the topic would be greatly appreciated.
Due to questions about the connection, here is what i have tried:
Server=localhost;Port=5433;User Id=databaseuser;Password=databaseuser_123;Database=db123;
Server=127.0.0.1;Port=5433;User Id=databaseuser;Password=databaseuser_123;Database=db123;
Server=10.223.132.123;Port=5433;User Id=databaseuser;Password=databaseuser_123;Database=db123;
The last being the local machines IP address.
Here is a short log of the program connecting and disconnecting from the server on Win 7:
// connecting
2012-08-27 11:26:00 EST ERROR: relation "db_events" does not exist at character 13
2012-08-27 11:26:00 EST STATEMENT: DELETE FROM "db_events"; DELETE FROM "db_events_counts";
2012-08-27 12:52:29 EST ERROR: relation "db_events" does not exist at character 13
2012-08-27 12:52:29 EST STATEMENT: INSERT INTO "db_events" VALUES ('114','1','2','1', to_timestamp('2012/08/27 12:52:29', 'YYYY/MM/DD HH24:MI:SS'),'2012', '8', '27', '12', '52', '29', '35' );
// disconnecting
2012-08-27 11:26:07 EST LOG: could not receive data from client: No connection could be made because the target machine actively refused it.
2012-08-27 11:26:07 EST LOG: unexpected EOF on client connection
SELECT relname FROM pg_class WHERE relkind = 'r' AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = 'public');. Print the results. Do you see the table you expect? Also trySELECT current_database();. The schema info functions may be useful: postgresql.org/docs/9.1/static/functions-info.html . It can also be handy to turn server-side query logging on withlog_statement='all'inpostgresql.confand reload/restart Pg, then examine the server logs.