pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Meskes <meskes@postgresql.org>
To: hoelc <hoelc@pd.jaring.my>
Cc: PostgreSQL Interfaces <pgsql-interfaces@postgresql.org>
Subject: Re: [INTERFACES] the last row in a table
Date: Tue, 9 Mar 1999 20:30:57 +0100
Message-ID: <19990309203057.A447@gmx.net> (raw)
In-Reply-To: <36E50F4A.CB527B78@pd.jaring.my>
References: <36E163D7.CD95C55A@pd.jaring.my>
	<87emn1fwsq.fsf@tolikus.hq.aaanet.ru>
	<36E50F4A.CB527B78@pd.jaring.my>

On Tue, Mar 09, 1999 at 08:08:43PM +0800, hoelc wrote:
> I am developing a database with PostgreSQL in Linux, and using ecpg to write the
> C program to communicate with the database.

Nice to hear that. :-)

> One of my application need to get the data from the last row in a table.

Now that statement is sort of a problem. In a relational model there is no
order of tuples in a relation. You can simulate this via a unique key of
course or maybe use the OID. Or do you mean the last tuple of a query?

> Is there any function or command that can tract which is the last row of data in
> a table?

Once you opened a cursor you can move it to the end of the query via the
move command. I never used this feature but I take it this is how it is
supposed to be. Afterwards you can fetch one record backward.

Michael

-- 
Michael Meskes                         | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
Email: Michael.Meskes@gmx.net          | Use PostgreSQL!



view thread (8+ messages)  latest in thread

Message-ID: <19990309203057.A447@gmx.net>
Permalink:  ../19990309203057.A447@gmx.net/
Also on:    postgresql.org/message-id/19990309203057.A447@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: meskes@postgresql.org, hoelc@pd.jaring.my
  Subject: Re: [INTERFACES] the last row in a table
  In-Reply-To: <19990309203057.A447@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox