Re: [PATCH v1] pg_ls_tmpdir to show directories

Поиск
Список
Период
Сортировка
Искать
От
Fabien COELHO
Тема
Re: [PATCH v1] pg_ls_tmpdir to show directories
Дата
Msg-id
alpine.DEB.2.21.2001151013200.11730@pseudo
Ответ на
Список
Дерево обсуждения
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Tom Lane <tgl@sss.pgh.pa.us>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Stephen Frost <sfrost@snowman.net>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Tom Lane <tgl@sss.pgh.pa.us>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Stephen Frost <sfrost@snowman.net>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Justin Pryzby <pryzby@telsasoft.com>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Stephen Frost <sfrost@snowman.net>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Justin Pryzby <pryzby@telsasoft.com>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Justin Pryzby <pryzby@telsasoft.com>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Justin Pryzby <pryzby@telsasoft.com>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) "Bossart, Nathan" <bossartn@amazon.com>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Justin Pryzby <pryzby@telsasoft.com>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Fabien COELHO <coelho@cri.ensmp.fr>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Justin Pryzby <pryzby@telsasoft.com>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Fabien COELHO <coelho@cri.ensmp.fr>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Justin Pryzby <pryzby@telsasoft.com>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Justin Pryzby <pryzby@telsasoft.com>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Andres Freund <andres@anarazel.de>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Michael Paquier <michael@paquier.xyz>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Michael Paquier <michael@paquier.xyz>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Justin Pryzby <pryzby@telsasoft.com>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Justin Pryzby <pryzby@telsasoft.com>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Greg Stark <stark@mit.edu>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Fabien COELHO <coelho@cri.ensmp.fr>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Fabien COELHO <coelho@cri.ensmp.fr>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Michael Paquier <michael@paquier.xyz>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Justin Pryzby <pryzby@telsasoft.com>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Michael Paquier <michael@paquier.xyz>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Justin Pryzby <pryzby@telsasoft.com>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Michael Paquier <michael@paquier.xyz>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Michael Paquier <michael@paquier.xyz>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Justin Pryzby <pryzby@telsasoft.com>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Justin Pryzby <pryzby@telsasoft.com>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Peter Smith <smithpb2250@gmail.com>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Fabien COELHO <coelho@cri.ensmp.fr>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Julien Rouhaud <rjuju123@gmail.com>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Justin Pryzby <pryzby@telsasoft.com>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Tom Lane <tgl@sss.pgh.pa.us>
Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) Justin Pryzby <pryzby@telsasoft.com>

Hello Justin,

About this v4.

It applies cleanly.

I'm trying to think about how to get rid of the strange structure and 
hacks, and the arbitrary looking size 2 array.

Also the recursion is one step, but I'm not sure why, ISTM it could/should 
go on always?

Maybe the recursive implementation was not such a good idea, if I 
suggested it is because I did not noticed the "return next" re-entrant 
stuff, shame on me.

Looking at the code, ISTM that relying on a stack/list would be much 
cleaner and easier to understand. The code could look like:

   ls_func()
     if (first_time)
       initialize description
       set next directory to visit
     while (1)
        if next directory
          init/push next directory to visit as current
        read current directory
          if emty
            pop/close current directory
          elif is_a_dir and recursion allowed
            set next directory to visit
          else ...
            return next tuple
     cleanup

The point is to avoid a hack around the directory_fctx array, to have only 
one place to push/init a new directory (i.e. call AllocateDir and play 
around with the memory context) instead of two, and to allow deeper 
recursion if useful.

Details : snprintf return is not checked. Maybe it should say why an 
overflow cannot occur.

"bool nulls[3] = { 0,};" -> "bool nulls[3} = { false, false, false };"?

-- 
Fabien.


В списке pgsql-hackers по дате отправления
От: Arthur Zakirov
Дата:
От: Maksim Milyutin
Дата:
FAQ