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

Re: MOVE strangeness

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kevin Brown <kevin(at)sysexperts(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: MOVE strangeness
Date: 2002-12-27 17:26:22
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
Kevin Brown <kevin(at)sysexperts(dot)com> writes:
> Tom Lane wrote:
>> The cursor must be considered to be positioned on its current row, not
>> between rows, or the SQL-defined operations UPDATE WHERE CURRENT OF and
>> DELETE WHERE CURRENT OF don't make any sense.  (We don't support those
>> yet, but we should someday.)

> Okay.  But then doesn't it make sense for FETCH to fetch the contents
> of the row (and subsequent requested rows) that the cursor is
> currently on *then* move, and not the other way around?

No, because WHERE CURRENT OF operates on the row last returned by FETCH,
according to the spec.  AFAICT, the conceptual model I described a
couple messages back corresponds directly to a subset of the SQL92
specification for cursors: "before first row", "on some row", and "after
last row" are all states described by the spec.  (It is a subset because
we don't support DELETE WHERE CURRENT OF --- if we did, we'd need
additional states to handle the situation where the cursor is pointing
at a just-deleted row.)

We don't get to define our own behavior for FETCH.

> Additionally, with that model, UPDATE WHERE CURRENT OF would work
> exactly as you'd expect in all situations: it would update the row the
> cursor is on or, if the cursor is beyond the last row, would fail.

How do you figure that?  It would operate on the row after the last one
you'd seen, which seems pretty darn bizarre (ie, useless and dangerous)
to me.

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: Olivier PRENANTDate: 2002-12-27 17:37:24
Subject: Re: Problems with 7.3.1
Previous:From: Tom LaneDate: 2002-12-27 16:34:01
Subject: Re: Problems with 7.3.1

pgsql-patches by date

Next:From: Bruce MomjianDate: 2002-12-29 03:55:53
Subject: cleanups
Previous:From: Bruce MomjianDate: 2002-12-27 14:48:19
Subject: Re: [HACKERS] MOVE strangeness

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