Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 2D7DC2E01E4 for ; Mon, 3 Mar 2008 10:32:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 55727-01-6 for ; Mon, 3 Mar 2008 10:32:31 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.168]) by postgresql.org (Postfix) with ESMTP id AA2F62E01A6 for ; Mon, 3 Mar 2008 10:31:37 -0400 (AST) Received: by wf-out-1314.google.com with SMTP id 28so53099wff.28 for ; Mon, 03 Mar 2008 06:31:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; bh=VGbktXgyawLWRsAf4YfpPriCj0WR6QSJyXanAjQNTFM=; b=JUVHlV/coOgOW2OVevKnVe2dCf8f7M/BtY3ZP2zVKQwblYJ1OjyNM0uGruKFZmYnG4FoxPWYUbKMgGB7ggJS+iSo3oALsbstmXCceU/ZKyGUwGIsGal/llg3myrwV0w107EcJwUQcJUJ7ddWZggZ1+m6qW4REnJGSUxmwPSHNV0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=dxXmWMNdm3QmBucwVP2C9imaWoaquj6mce/fyJ7xewXojUHQznI1WL10ldMMifiuCMw9P7pdaDnNiB8R1PQ8S0C+3S7qekzGc1js0tawWJFVWrJVvxsdmaYl4Y7kJMi8EKNSvwh+zQ0vzvW8ChZZSGx97YmtreLE/rgRXjCIn48= Received: by 10.142.156.2 with SMTP id d2mr9053069wfe.219.1204554696141; Mon, 03 Mar 2008 06:31:36 -0800 (PST) Received: by 10.142.188.12 with HTTP; Mon, 3 Mar 2008 06:31:36 -0800 (PST) Message-ID: <396486430803030631k6151b908p6995227883501ceb@mail.gmail.com> Date: Mon, 3 Mar 2008 06:31:36 -0800 From: "Richard Broersma" To: "Premsun Choltanwanich" Subject: Re: PostgreSQL does not support updateable cursors Cc: pgsql-odbc@postgresql.org In-Reply-To: <47CC056A.C5F7.004C.0@nsasia.co.th> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_19846_4532381.1204554696125" References: <47CC056A.C5F7.004C.0@nsasia.co.th> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.28 tagged_above=0 required=5 tests=AWL=0.279, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200803/2 X-Sequence-Number: 9418 ------=_Part_19846_4532381.1204554696125 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Sun, Mar 2, 2008 at 11:06 PM, Premsun Choltanwanich wrote: > Dear All, > > Regarding to my conversation on mailing list as shown below, Is my > problem related with any function on psqlODBC ? And, How can I fix it? > > No, the problem is not with the ODBC driver. The problem is that views in postgresql are static non-update-able by default. So if you try to update and record in a view using a cursor or any other sql statement, you will get an error. This problem can be fixed if your view meets the following criteria: 1) your view is based on only one table 2) your create rules for your view that define how updates to the view are to be handled/cascaded to the base table. http://www.postgresql.org/docs/8.3/interactive/sql-createrule.html 3) since postgresql rules can only handle update statements that affect only one tuple at a time, your cursor must only be able to update one record at a time. Regards, Richard Broersma Jr. ------=_Part_19846_4532381.1204554696125 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Sun, Mar 2, 2008 at 11:06 PM, Premsun Choltanwanich <Premsun@nsasia.co.th> wrote:
Dear All,
 
     Regarding to my conversation on mailing list as shown below, Is my problem related with any function on psqlODBC ? And, How can I fix it?
 
No, the problem is not with the ODBC driver.  The problem is that views in postgresql are static non-update-able by default.  So if you try to update and record in a view using a cursor or any other sql statement, you will get an error.

This problem can be fixed if your view meets the following criteria:

1) your view is based on only one table

2) your create rules for your view that define how updates to the view are to be handled/cascaded to the base table.
http://www.postgresql.org/docs/8.3/interactive/sql-createrule.html

3) since postgresql rules can only handle update statements that affect only one tuple at a time, your cursor must only be able to update one record at a time.


Regards,
Richard Broersma Jr.
------=_Part_19846_4532381.1204554696125--