Int64 bug

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
hmuscroft
Posts: 23
Joined: Tue 28 Nov 2006 10:07

Int64 bug

Post by hmuscroft » Fri 09 Mar 2007 09:24

Hi,

I use 64bit integers quite a lot and am running into problems. I am trying to execute this query :-
INSERT INTO logon (id, staff_id, username, pcid, pcname) VALUES
(1090307192896810146,1823700001955521506,'smith','46173199','alpha');
The result is :-
CoreLab.PostgreSql.PgSqlException was unhandled by user code
Message="value \"1823700001955521506\" is out of range for type integer"
Source="mscorlib"
ErrorCode=-2147467259
CallStack="PL/pgSQL function \"before_post_record\" line 4 at assignment"
DetailMessage=""
FileName="numutils.c"
Hint=""
LineNumber=77
Position=0
ProcedureName="pg_atoi"
StackTrace:
Server stack trace:
at CoreLab.PostgreSql.PgSqlCommand.a(CommandBehavior A_0, IDisposable A_1, Int32 A_2, Int32 A_3)
at CoreLab.Common.DbCommandBase.c(CommandBehavior A_0)
at CoreLab.Common.DbCommandBase.ExecuteNonQuery()
at CoreLab.Common.DbCommandBase.a(CommandBehavior A_0)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)...
But "1823700001955521506" is a perfectly valid int64 value, and I can execute this SQL statement using PgAdmin quite happily.

Here is the SQL to create the table in question so that you can try it for yourself :-
CREATE TABLE logon
(
id bigint NOT NULL,
staff_id bigint NOT NULL,
username character varying(50) NOT NULL,
pcid character varying(50) NOT NULL,
pcname character varying(50),
ipaddress character varying(50),
query boolean,
CONSTRAINT logon_pkey PRIMARY KEY (id)
) WITHOUT OIDS;
Please help!

hmuscroft
Posts: 23
Joined: Tue 28 Nov 2006 10:07

Post by hmuscroft » Fri 09 Mar 2007 14:03

Found the problem - it was actually in a TRIGGER function in my PGSQL database rather than a bug in the .NET provider.

Apologies!

However, I have been waiting for a reply to my other problem for a number of days now :-
http://crlab.com/forums/viewtopic.php?t=9229

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Mon 12 Mar 2007 08:23

Sorry for delay. We have been having days off all this period. You've already been answered at http://crlab.com/forums/viewtopic.php?t=9229. Check out.

Post Reply