Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XoEvW-0002rq-8h for pgsql-odbc@arkaria.postgresql.org; Tue, 11 Nov 2014 17:08:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XoEvV-0004Ce-Kn for pgsql-odbc@arkaria.postgresql.org; Tue, 11 Nov 2014 17:08:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XoEvU-0004CX-PC for pgsql-odbc@postgresql.org; Tue, 11 Nov 2014 17:08:20 +0000 Received: from mout.kundenserver.de ([212.227.126.187]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XoEvQ-0002X9-C7 for pgsql-odbc@postgresql.org; Tue, 11 Nov 2014 17:08:19 +0000 Received: from Darkstar (mail.luratech.com [212.202.239.23]) by mrelayeu.kundenserver.de (node=mreue004) with ESMTP (Nemesis) id 0MR97T-1XQqLC2TT5-00UXPu; Tue, 11 Nov 2014 18:08:13 +0100 From: =?iso-8859-1?Q?Nils_G=F6sche?= To: Subject: Bug? {? = CALL insert_page_segment (?, ?)} Date: Tue, 11 Nov 2014 18:08:04 +0100 Message-ID: <002701cffdd2$0f2842d0$2d78c870$@cartan.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 15.0 Content-Language: de Thread-Index: Ac/9zTgscJ5MRdgUQcCrnN2E9ThWjw== X-Provags-ID: V02:K0:Qw4ssRPkKU2r9H8L+24UJG5CGBXWE/r8T0lmJsNA07P m2scjvYNqS7+6eFgT1HbhUfiKZ9/cgKLQHk2dIC8iHzhq0gBvv BndfhkAjCGLJfWhBK372B8I1yTJ6Gkh1m45qpRL0utCecxDw43 /ZTcoCw/oURgWyLiRotMsFqjSNZl8o4Avo3Qy8gTRoKfmatzCP z7YlaOHySb9Bqhqm6kE8S3XTjiB9At0uuxSkbbwZhvHF+3HBBc I4mnRp8bK+zp4QgAp+iQ5OfYzRyA50OAbQMDOalEgSlwCC55l7 y2rFQqGJ5TktpLUkTIgWSI4HIh0ZcRUrOSVw9hV9lyFl860YxF MLjsaXRqBLFiVmjPJ9CBJhnF5eGUVRFQu2St/rk2n X-UI-Out-Filterresults: notjunk:1; X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org Hi! I have a problem with newer versions of the ODBC driver. I made a small testing example to reproduce the problem: The following code works fine with version 09.02.0100 of the driver. With 09.03.0210, it crashes. With 09.03.0400, I get a strange exception and error message. This is all on Windows, 32-Bit. I tried Windows 7 and Windows 8.1; I also tried Postgres versions 9.2.4, 9.2.9, 9.3.4 and 9.3.5, all 32-Bit. Here is the create script for the database: CREATE TABLE page_segments ( task_id uuid, id uuid, PRIMARY KEY (task_id, id) ); CREATE FUNCTION insert_page_segment(theTaskId uuid, theId uuid) RETURNS int AS $$ DECLARE ret int NOT NULL :=3D 0;=20 BEGIN BEGIN INSERT INTO page_segments (task_id, id) VALUES (theTaskId, theId);=20 ret :=3D 1;=20 EXCEPTION WHEN unique_violation THEN -- ignore END;=20 RETURN ret;=20 END $$ LANGUAGE plpgsql; And here is some C# code that calls the insert_page_segment function: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data; using System.Data.Odbc; namespace ODBCTest { class Program { const string ConnString =3D @"Driver=3D{PostgreSQL Unicode};server=3Dlocalhost;port=3D5432;database=3Dstringtest;uid=3Dcartan;= pwd=3D..."; static void Main(string[] args) { using (var conn =3D new OdbcConnection(ConnString)) { conn.Open(); Guid g1 =3D Guid.NewGuid(); Guid g2 =3D Guid.NewGuid(); Console.WriteLine("First call returns {0}", CallTheFunc(conn, g1, g2)); } Console.WriteLine("Press any key to exit..."); Console.ReadKey(true); } static int CallTheFunc(OdbcConnection conn, Guid taskId, Guid id) { using (var trans =3D conn.BeginTransaction()) { try { const string insertCmdText =3D @"{? =3D CALL insert_page_segment (?, ?)}"; using (var insertCmd =3D new OdbcCommand(insertCmdText, conn, trans)) { var retParam =3D new OdbcParameter(); retParam.OdbcType =3D OdbcType.Int; retParam.Direction =3D ParameterDirection.ReturnVal= ue; insertCmd.Parameters.Add(retParam); var taskIdParam =3D new OdbcParameter(); taskIdParam.OdbcType =3D OdbcType.UniqueIdentifier; taskIdParam.Value =3D taskId; insertCmd.Parameters.Add(taskIdParam); var idParam =3D new OdbcParameter(); idParam.OdbcType =3D OdbcType.UniqueIdentifier; idParam.Value =3D id; insertCmd.Parameters.Add(idParam); insertCmd.ExecuteNonQuery(); int ret =3D (int) retParam.Value; trans.Commit(); return ret; } } catch { trans.Rollback(); throw; } } } } } With the old 9.2.1 driver, the function just returns 1 as expected. With 9.3.4, I get an unusual InvalidOperationException in ExecuteNonQuery(), saying "This OdbcTransaction has completed; it is no longer usable." In the Postgres log file, I find this message: 2014-11-11 17:26:04 CET ERROR: function insert_page_segment(unknown) does not exist at character 8 2014-11-11 17:26:04 CET HINT: No function matches the given name and argument types. You might need to add explicit type casts. 2014-11-11 17:26:04 CET STATEMENT: SELECT insert_page_segment ($1, $2) 2014-11-11 17:26:04 CET FATAL: invalid frontend message type 0 Can anybody help me with this? Regards, -- Nils G=F6sche=20 Don=92t ask for whom the tolls.=20 --=20 Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc