Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id AB6CCF765A for ; Wed, 11 Apr 2012 19:01:47 -0300 (ADT) Received: from rs135.luxsci.com ([74.205.104.184]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SI5bm-0008HC-DA for pgsql-odbc@postgresql.org; Wed, 11 Apr 2012 22:01:47 +0000 Received: from [192.168.0.100] (50-52-20-202.cral.id.frontiernet.net [50.52.20.202]) (authenticated bits=0) by rs135.luxsci.com (8.13.8/8.13.8) with ESMTP id q3BM1VqD031970 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 11 Apr 2012 17:01:32 -0500 Message-ID: <4F85FF40.5080802@infowerks.com> Date: Wed, 11 Apr 2012 15:01:36 -0700 From: Ken Benson User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 To: pgsql-odbc@postgresql.org Subject: UPDATE table via ODBC fails. Content-Type: multipart/alternative; boundary="------------020905000209090906010704" X-Lux-Comment: Message q3BM1VqD031970 sent by user #92247 X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201204/9 X-Sequence-Number: 10823 This is a multi-part message in MIME format. --------------020905000209090906010704 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit I have a fairly straightforward routine which uses an ODBC connection to do 4 steps: * DROP TABLE IF EXISTS tmp_rxpurge * CREATE TABLE tmp_rxpurge (rxnum VARCHAR(300),dt_wrt DATE,dt_lastfill DATE,dt_lastact DATE, b_purge BOOLEAN) * INSERT INTO tmp_rxpurge (rxnum,dt_wrt,b_purge) SELECT "RXNUM","DATE",'f' FROM rx * UPDATE tmp_rxpurge as t SET dt_lastfill = rf.dt_lastfill FROM (SELECT "RXNUM" AS rxnum, Max("DATE") as dt_lastfill FROM transactions GROUP BY "RXNUM") as rf WHERE rf.rxnum=t.rxnum The first three commands are executed perfectly as expected. The update fails to do anything. There is no error generated. I have enabled 'logging' in the ODBC connector - and I don't see anything out of the ordinary in the short-log. (The long-log - I have no idea what all that stuff means.) If I copy that last command into a psql window - it executes - and works fine. But - it will not work via the ODBC connector. What's going on? Ken --------------020905000209090906010704 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I have a fairly straightforward routine which uses an ODBC connection to do 4 steps:

  • DROP TABLE IF EXISTS tmp_rxpurge
  • CREATE TABLE tmp_rxpurge (rxnum VARCHAR(300),dt_wrt DATE,dt_lastfill DATE,dt_lastact DATE, b_purge BOOLEAN)
  • INSERT INTO tmp_rxpurge (rxnum,dt_wrt,b_purge) SELECT "RXNUM","DATE",'f' FROM rx
  • UPDATE tmp_rxpurge as t SET dt_lastfill = rf.dt_lastfill FROM (SELECT "RXNUM" AS rxnum, Max("DATE") as dt_lastfill FROM transactions GROUP BY "RXNUM") as rf WHERE rf.rxnum=t.rxnum

The first three commands are executed perfectly as expected.
The update fails to do anything.
There is no error generated.
I have enabled 'logging' in the ODBC connector - and I don't see anything out of the ordinary in the short-log. (The long-log - I have no idea what all that stuff means.)

If I copy that last command into a psql window - it executes - and works fine.

But - it will not work via the ODBC connector.

What's going on?

Ken
--------------020905000209090906010704--