Re: [INTERFACES] the last row in a table

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: hoelc <hoelc(at)pd(dot)jaring(dot)my>
Cc: PostgreSQL Interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: [INTERFACES] the last row in a table
Date: 1999-03-09 19:30:57
Message-ID: 19990309203057.A447@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-interfaces

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(dot)Meskes(at)gmx(dot)net | Use PostgreSQL!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Brett W. McCoy 1999-03-09 20:29:11 Re: [GENERAL] i want to start automaticly postgres when a reboot my server...help please.....
Previous Message Jason Boxman 1999-03-09 19:28:08 plpgsql

Browse pgsql-interfaces by date

  From Date Subject
Next Message Peter T Mount 1999-03-09 19:56:28 Re: [INTERFACES] JDBC Will not compile Error 139?
Previous Message Dustin Sallings 1999-03-09 19:24:15 Re: [GENERAL] Re: [INTERFACES] the last row in a table