Re: PostgreSQL: SQLSetPos fails with SetPos update return error.

From: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: "Venkatesan, Sekhar" <sekhar(dot)venkatesan(at)emc(dot)com>, "Inoue, Hiroshi" <h-inoue(at)dream(dot)email(dot)ne(dot)jp>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, "pgsql-odbc(at)postgresql(dot)org" <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: PostgreSQL: SQLSetPos fails with SetPos update return error.
Date: 2016-04-20 02:47:02
Message-ID: 0A3221C70F24FB45833433255569204D1F563F26@G01JPEXMBYT05
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

From: Venkatesan, Sekhar [mailto:sekhar(dot)venkatesan(at)emc(dot)com]
FYI: After I enable DB partitioning feature , I see this problem.

I guess your app performed an UPDATE statement which changes the value of the partitioning key columns.

Unfortunately, as Inoue-san said, the ODBC driver cannot handle that case. Changing the partitioning key value causes the database server to move the row to a different partition (= child table). On the other hand, the ODBC driver uses the table name and ctid to position the row to update. But the driver uses the original table name, not the target child table name, failing to find the row to update. The driver cannot know the appropriate child table name. It it due to the lack of real partitioning as in other database products that the client side has to be aware of the child table.

Your case is described in the manual below. As mentioned, the workaround is to use UPDATE trigger.

http://www.postgresql.org/docs/current/static/ddl-partitioning.html#DDL-PARTITIONING-CAVEATS

[Excerpt]
The schemes shown here assume that the partition key column(s) of a row never change, or at least do not change enough to require it to move to another partition. An UPDATE that attempts to do that will fail because of the CHECK constraints. If you need to handle such cases, you can put suitable update triggers on the partition tables, but it makes management of the structure much more complicated.

Regards
Takayuki Tsunakawa

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Venkatesan, Sekhar 2016-04-20 03:13:59 Re: PostgreSQL: SQLSetPos fails with SetPos update return error.
Previous Message Inoue, Hiroshi 2016-04-19 23:43:51 Re: PostgreSQL: SQLSetPos fails with SetPos update return error.