X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 183868B9FFA for ; Thu, 3 Feb 2005 21:11:32 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95896-02 for ; Thu, 3 Feb 2005 21:11:28 +0000 (GMT) Received: from smtp103.rog.mail.re2.yahoo.com (smtp103.rog.mail.re2.yahoo.com [206.190.36.81]) by svr1.postgresql.org (Postfix) with SMTP id CA8948B9FEA for ; Thu, 3 Feb 2005 21:11:28 +0000 (GMT) Received: from unknown (HELO brampmaster) (givens5425@24.114.227.235 with login) by smtp103.rog.mail.re2.yahoo.com with SMTP; 3 Feb 2005 21:11:27 -0000 From: "Brien R. Givens" To: Subject: Re: Welcome to the pgsql-odbc list! Date: Thu, 3 Feb 2005 16:11:33 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 In-Reply-To: <200502032030.j13KU68p029396@hosting.commandprompt.com> Thread-Index: AcUKLzBMtVfZF+wNTnWcPxp3dLBXQgAAa/2w Message-Id: <20050203211128.CA8948B9FEA@svr1.postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.704 tagged_above=0 required=5 tests=MSGID_FROM_MTA_ID X-Spam-Level: * X-Archive-Number: 200502/11 X-Sequence-Number: 4901 Hello, This is my first post to the mailing list. I joined because I'm having an issue working with PostgreSQL in ASP. I hope this is the right place to discuss this issue. I'm confident of my code and have the same approach working in MySQL, SQL Server, Oracle and Access which leads me to believe the problem may be due to a bug in the ODBC driver. The problem deals with sequence numbers in new records not being returned to ASP after an update. I ran the test with two tables, the first using a serial column, the second using an integer column manually attached to a sequence: Table One CREATE TABLE test (pid serial, one int) Table Two CREATE TABLE test (pid int, one int) CREATE SEQUENCE test_seq CREATE FUNCTION test_fun() RETURNS TRIGGER AS 'BEGIN NEW.PID := NEXTVAL(''test_seq''); RETURN NEW; END; 'LANGUAGE PLPGSQL; CREATE TRIGGER test_trg BEFORE INSERT ON test FOR EACH ROW EXECUTE PROCEDURE test_fun(); ASP Dim conn, rs Set conn = Server.CreateObject("ADODB.Connection") Set rs = Server.CreateObject("ADODB.recordset") conn.Open "Driver={PostgreSQL};Server=localhost;Database=db;UID=uid;PWD=pwd" rs.Open "SELECT * FROM test WHERE False", conn, adOpenUnspecified, adLockPessimistic rs.AddNew rs("one") = 1 rs.Update Response.Write TypeName(rs("pid").Value) & "
" In both cases the output is "Empty". I used TypeName in the Response.Write simply to illustrate that the value is empty; Response.Write rs("pid").Value displays nothing in the browser. I understand that I can use the currval to determine the value but for the purposes of the project I'm working on I don't want to get into needing to know the name of the sequence attached to the column. Also, this problem has bigger implications - while this simple test has only the one stored procedure modifying the one field, a more complex scenario may alter many fields upon insert. These changes should be passed back to ASP when the Update method is called.