Re: PostgreSQL: SQLSetPos fails with SetPos update return error. - Mailing list pgsql-odbc

From Tsunakawa, Takayuki
Subject Re: PostgreSQL: SQLSetPos fails with SetPos update return error.
Date
Msg-id 0A3221C70F24FB45833433255569204D1F563F26@G01JPEXMBYT05
Whole thread Raw
In response to Re: PostgreSQL: SQLSetPos fails with SetPos update return error.  ("Venkatesan, Sekhar" <sekhar.venkatesan@emc.com>)
Responses Re: PostgreSQL: SQLSetPos fails with SetPos update return error.  ("Venkatesan, Sekhar" <sekhar.venkatesan@emc.com>)
List pgsql-odbc

From: Venkatesan, Sekhar [mailto:sekhar.venkatesan@emc.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

pgsql-odbc by date:

Previous
From: "Inoue, Hiroshi"
Date:
Subject: Re: PostgreSQL: SQLSetPos fails with SetPos update return error.
Next
From: "Venkatesan, Sekhar"
Date:
Subject: Re: PostgreSQL: SQLSetPos fails with SetPos update return error.