Re: reg:lseek&read ..pls - Mailing list pgsql-admin

From Tom Lane
Subject Re: reg:lseek&read ..pls
Date
Msg-id 9691.1135611507@sss.pgh.pa.us
Whole thread Raw
In response to reg:lseek&read ..pls  ("sandhya" <sandhyar@amiindia.co.in>)
List pgsql-admin
"sandhya" <sandhyar@amiindia.co.in> writes:
> But before that i need to know the size of the object from which i am =
> trying to get the contents.
> How can i do this?

Same way you'd do it for a Unix file: seek to the end, note the end
offset, seek back to the start and read.

    ... lo_open ...
    lo_size = lo_lseek(conn, fd, 0, SEEK_END);  // where's the end?
    lo_lseek(conn, fd, 0, SEEK_SET);  // go back to start

            regards, tom lane

pgsql-admin by date:

Previous
From: Alain Rodriguez Arias
Date:
Subject: Re: lo_ functions
Next
From: Tom Lane
Date:
Subject: Re: vacuuming template0 gave ERROR