Skip site navigation (1) Skip section navigation (2)

Re: Updatable Cursors, CTID, and Views

From: Janet Borschowa <borschow(at)roguewave(dot)com>
To: Mark Dexter <MDEXTER(at)dexterchaney(dot)com>, pgsql-odbc(at)postgresql(dot)org
Cc: 'Dave Page' <dpage(at)vale-housing(dot)co(dot)uk>
Subject: Re: Updatable Cursors, CTID, and Views
Date: 2004-07-28 16:18:03
Message-ID: D486606E7AD20947BDB7E56862E04C39BDC6E7@cvo1.cvo.roguewave.com (view raw or flat)
Thread:
Lists: pgsql-odbc
Hi,
I believe that Hiroshi probably used the ctid because views are not
updateable. It looks like you have to do extra work to update a view and in
that case, I'm not sure how a cursor in the driver would be implemented as
there needs to be a way to uniquely identify a row which is why Hiroshi used
the ctid column. 
 
>From the PostgreSQL docs for the SQL statement "CREATE VIEW":
Description

CREATE VIEW defines a view of a query. The view is not physically
materialized. Instead, the query is run every time the view is referenced in
a query.

...

Notes

Currently, views are read only: the system will not allow an insert, update,
or delete on a view. You can get the effect of an updatable view by creating
rules that rewrite inserts, etc. on the view into appropriate actions on
other tables. For more information see CREATE RULE.

Sorry I can't be of help but I don't know if or how you could define a view
with a ctid column and appropriate rules to enable the driver to use a
cursor on it. 
 
========================
Janet Borschowa
Software Engineer, Database Products                       
Rogue Wave Software, a QUOVADX(tm) Division
(541) 753-1931   FAX: (541) 757-4630
mailto:borschow(at)roguewave(dot)com <mailto:borschow(at)roguewave(dot)com>
http://www.roguewave.com <http://www.roguewave.com/>  

-----Original Message-----
From: Dave Page [mailto:dpage(at)vale-housing(dot)co(dot)uk] 
Sent: Wednesday, July 28, 2004 12:29 AM
To: Mark Dexter; pgsql-odbc(at)postgresql(dot)org
Subject: Re: [ODBC] Updatable Cursors, CTID, and Views


 


  _____  

From: pgsql-odbc-owner(at)postgresql(dot)org
[mailto:pgsql-odbc-owner(at)postgresql(dot)org] On Behalf Of Mark Dexter
Sent: 27 July 2004 23:26
To: pgsql-odbc(at)postgresql(dot)org
Subject: [ODBC] Updatable Cursors, CTID, and Views



From a prior posting on November 5, 2002, I found this text regarding the
use of CTID in the ODBC driver: 

The driver uses CTID and OID to implement updatable cursors. Please turn off
the *Updatable cursors* DSN option if you don't like the behavior. regards,
Hiroshi Inoue 

I am having a problem where I need to use updatable cursors with views.  It
appears that the ODBC driver is trying to use the CTID and OID columns and
that views don't have these columns.  Is it possible to use updatable
cursors with views via the PostgreSQL ODBC driver?

 Not from what Hiroshi has said (he wrote the cursor code). I imagine he
used CTID because it needs to be able to locate the exact version of each
row - in a view that won't work because ctid don't exist. I guess you could
try adding it to your view definition though that will probably only work
for single table views of course.

I'm not sure why he would have used oid given that it may not exist even in
a table...

Regards, Dave.

pgsql-odbc by date

Next:From: Antonio PenninoDate: 2004-07-28 18:44:38
Subject: Re: problem with CVS version
Previous:From: Dave PageDate: 2004-07-28 07:28:59
Subject: Re: Updatable Cursors, CTID, and Views

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group