Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJ7si-0001CK-VE for pgsql-odbc@arkaria.postgresql.org; Fri, 01 Jul 2016 23:29:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bJ7si-0003Zt-3Y for pgsql-odbc@arkaria.postgresql.org; Fri, 01 Jul 2016 23:29:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bJ7sK-0003BQ-JF for pgsql-odbc@postgresql.org; Fri, 01 Jul 2016 23:29:32 +0000 Received: from mail1.asahi-net.or.jp ([202.224.39.197]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJ7sE-00089Y-Qs for pgsql-odbc@postgresql.org; Fri, 01 Jul 2016 23:29:31 +0000 Received: from [192.168.1.3] (h216215.dynamic.ppp.asahi-net.or.jp [61.114.216.215]) by mail1.asahi-net.or.jp (Postfix) with ESMTP id 5F016131DA; Sat, 2 Jul 2016 08:29:17 +0900 (JST) Subject: Re: Updateable cursors ODBC configuration Partition Issue To: "Venkatesan, Sekhar" References: Cc: "Tsunakawa, Takayuki" , Adrian Klaver , "Joshua D. Drake" , "pgsql-odbc@postgresql.org" From: "Inoue, Hiroshi" Message-ID: <5776FCCE.7080809@dream.email.ne.jp> Date: Sat, 2 Jul 2016 08:29:18 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------090407090609070801030001" X-Pg-Spam-Score: -2.6 (--) 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 This is a multi-part message in MIME format. --------------090407090609070801030001 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit On 2016/07/01 18:07, Venkatesan, Sekhar wrote: > > Hi Guys, > > I see yet another issue when data partition is enabled and “updateable > cursors” option is enabled in odbc DSN. > > Updateable cursors performs “select for update” cursor and when the > PostgreSQL cursor is created for a select query, the resultant > statement is as below: > > The original SQL fired from our application is: > > “SELECT > AFD_.r_object_id,AFD_.name,AFD_.stamp,AFD_.sent_by,AFD_.date_sent,AFD_.due_date,AFD_.event,AFD_.item_name,AFD_.item_id,AFD_.item_type,AFD_.content_type,AFD_.message,AFD_.router_id,AFD_.supervisor_name,AFD_.task_number,AFD_.task_name,AFD_.task_type,AFD_.task_state,AFD_.dependency_type,AFD_.next_tasks_type,AFD_.instruction_page,AFD_.plan_start_date,AFD_.actual_start_date,AFD_.read_flag,AFD_.delete_flag,AFD_.priority,AFD_.position,AFD_.dequeued_by,AFD_.dequeued_date,AFD_.sign_off_required,AFD_.sign_off_user,AFD_.sign_off_date,AFD_.a_content_type,AFD_.a_operations,AFD_.source_docbase,AFD_.target_docbase,AFD_.remote_pending,AFD_.source_event,AFD_.source_stamp,AFD_.task_subject,AFD_.i_event_flags,AFD_.event_detail,AFD_.i_partition,AFD_.i_is_replica,AFD_.i_vstamp > FROM dmi_queue_item_s AFD_ WHERE ((AFD_.name=N'Administrator' AND > AFD_.read_flag=0) AND AFD_.delete_flag=0)” > Hmm, table alias AFD_. is necessary for the above statement? regards, Hiroshi Inoue > > whereas this is converted to: > > “SELECT > > *AFD_*.r_object_id,AFD_.name,AFD_.stamp,AFD_.sent_by,AFD_.date_sent,AFD_.due_date,AFD_.event,AFD_.item_name,AFD_.item_id,AFD_.item_type,AFD_.content_type,AFD_.message,AFD_.router_id,AFD_.supervisor_name,AFD_.task_number,AFD_.task_name,AFD_.task_type,AFD_.task_state,AFD_.dependency_type,AFD_.next_tasks_type,AFD_.instruction_page,AFD_.plan_start_date,AFD_.actual_start_date,AFD_.read_flag,AFD_.delete_flag,AFD_.priority,AFD_.position,AFD_.dequeued_by,AFD_.dequeued_date,AFD_.sign_off_required,AFD_.sign_off_user,AFD_.sign_off_date,AFD_.a_content_type,AFD_.a_operations,AFD_.source_docbase,AFD_.target_docbase,AFD_.remote_pending,AFD_.source_event,AFD_.source_stamp,AFD_.task_subject,AFD_.i_event_flags,AFD_.event_detail,AFD_.i_partition,AFD_.i_is_replica,AFD_.i_vstamp > , "ctid", "tableoid" *from "repo50"."p1_dmi_queue_item_s"* where *ctid > = currtid2('"repo50"."p1_dmi_queue_item_s"', '(13, 28)')”* > > Notice that *"p1_dmi_queue_item_s" *is a partitioned table*. *Here the > highlighted color is generated by postgresql for faster execution. > *But the table alias is not added to the partitioned table (AFD_ is > not added to p1_dmi_queue_item_s) due to which the SQL fails to > execute with the below error:* > > *ERROR: missing FROM-clause entry for table "afd_" at character 8* > > ** > > Is this a known issue? Is there any fix? If so, is it in psqlODBC or > in the server itself? > > Thanks, > > Sekhar > --------------090407090609070801030001 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit

On 2016/07/01 18:07, Venkatesan, Sekhar wrote:

Hi Guys,

 

I see yet another issue when data partition is enabled and “updateable cursors” option is enabled in odbc DSN.

Updateable cursors performs “select for update” cursor and when the PostgreSQL cursor is created for a select query, the resultant statement is as below:

The original SQL fired from our application is:

“SELECT AFD_.r_object_id,AFD_.name,AFD_.stamp,AFD_.sent_by,AFD_.date_sent,AFD_.due_date,AFD_.event,AFD_.item_name,AFD_.item_id,AFD_.item_type,AFD_.content_type,AFD_.message,AFD_.router_id,AFD_.supervisor_name,AFD_.task_number,AFD_.task_name,AFD_.task_type,AFD_.task_state,AFD_.dependency_type,AFD_.next_tasks_type,AFD_.instruction_page,AFD_.plan_start_date,AFD_.actual_start_date,AFD_.read_flag,AFD_.delete_flag,AFD_.priority,AFD_.position,AFD_.dequeued_by,AFD_.dequeued_date,AFD_.sign_off_required,AFD_.sign_off_user,AFD_.sign_off_date,AFD_.a_content_type,AFD_.a_operations,AFD_.source_docbase,AFD_.target_docbase,AFD_.remote_pending,AFD_.source_event,AFD_.source_stamp,AFD_.task_subject,AFD_.i_event_flags,AFD_.event_detail,AFD_.i_partition,AFD_.i_is_replica,AFD_.i_vstamp FROM dmi_queue_item_s AFD_ WHERE ((AFD_.name=N'Administrator' AND AFD_.read_flag=0) AND AFD_.delete_flag=0)”


Hmm,  table alias AFD_. is necessary for the above statement?

regards,
Hiroshi Inoue

 

whereas this is converted to:

 

“SELECT

AFD_.r_object_id,AFD_.name,AFD_.stamp,AFD_.sent_by,AFD_.date_sent,AFD_.due_date,AFD_.event,AFD_.item_name,AFD_.item_id,AFD_.item_type,AFD_.content_type,AFD_.message,AFD_.router_id,AFD_.supervisor_name,AFD_.task_number,AFD_.task_name,AFD_.task_type,AFD_.task_state,AFD_.dependency_type,AFD_.next_tasks_type,AFD_.instruction_page,AFD_.plan_start_date,AFD_.actual_start_date,AFD_.read_flag,AFD_.delete_flag,AFD_.priority,AFD_.position,AFD_.dequeued_by,AFD_.dequeued_date,AFD_.sign_off_required,AFD_.sign_off_user,AFD_.sign_off_date,AFD_.a_content_type,AFD_.a_operations,AFD_.source_docbase,AFD_.target_docbase,AFD_.remote_pending,AFD_.source_event,AFD_.source_stamp,AFD_.task_subject,AFD_.i_event_flags,AFD_.event_detail,AFD_.i_partition,AFD_.i_is_replica,AFD_.i_vstamp , "ctid", "tableoid" from "repo50"."p1_dmi_queue_item_s" where ctid = currtid2('"repo50"."p1_dmi_queue_item_s"', '(13, 28)')”

 

Notice that "p1_dmi_queue_item_s" is a partitioned table. Here the highlighted color is generated by postgresql for faster execution. But the table alias is not added to the partitioned table (AFD_ is not added to p1_dmi_queue_item_s) due to which the SQL fails to execute with the below error:

ERROR:  missing FROM-clause entry for table "afd_" at character 8

 

Is this a known issue? Is there any fix? If so, is it in psqlODBC or in the server itself?

 

Thanks,

Sekhar

--------------090407090609070801030001--