Re: pg_read_file() with virtual files returns empty string
| От | Tom Lane |
|---|---|
| Тема | Re: pg_read_file() with virtual files returns empty string |
| Дата | |
| Msg-id | 284570.1593381616@sss.pgh.pa.us обсуждение |
| Ответ на | Re: pg_read_file() with virtual files returns empty string (Joe Conway <mail@joeconway.com>) |
| Ответы |
Re: pg_read_file() with virtual files returns empty string
|
| Список | pgsql-hackers |
Joe Conway <mail@joeconway.com> writes:
> All good stuff -- I believe the attached checks all the boxes.
Looks okay to me, except I think you want
! if (bytes_to_read > 0)
to be
! if (bytes_to_read >= 0)
As it stands, a zero request will be treated like -1 (read all the
rest of the file) while ISTM it ought to be an expensive way to
read zero bytes --- perhaps useful to check the filename and seek
offset validity?
> The intention here seems to be that if you pass bytes_to_read = -1 with a
> negative offset, it will give you the last offset bytes of the file.
I think it's just trying to convert bytes_to_read = -1 into an explicit
positive length-to-read in all cases. We don't need that anymore with
this code, so dropping it is fine.
regards, tom lane
В списке pgsql-hackers по дате отправления: