Re: search_path improvements
От | Greg Stark |
---|---|
Тема | Re: search_path improvements |
Дата | |
Msg-id | 4136ffa0906011205o42eb2922ubd3c75c9db162cd5@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: search_path improvements (Alvaro Herrera <alvherre@commandprompt.com>) |
Ответы |
Re: search_path improvements
|
Список | pgsql-hackers |
On Mon, Jun 1, 2009 at 7:57 PM, Alvaro Herrera <alvherre@commandprompt.com> wrote: > Josh Berkus wrote: > >>> Well I don't mind push but I still think pop is an error. What you >>> really want to do is restore it to the value you started with. You >>> don't want to remove the last element since that may not be the >>> element you added. Some function you called may have added an extra >>> element on the head. >> >> Yeah, "pop" is a misnomer; what I'd want is >> search_path_del(search_path,'admin') ... that is, a way to remove a >> specific schema from the list. > > Except that "del" shouldn't delete if your "push" didn't add it because > it was already present. So you actually want some sort of refcounting > there somehow. As I said earlier I doubt "pop" or "delete" is ever going to actually be what you want. I suspect you're far more likely to want to restore it to what it was before you started altering it. As support I'll point out this is what our C api has. There's no short cut to strip out a single element of the path but the normal calling pattern is to set aside a copy of the old path, add modify it in some way -- often adding a schema to the head -- then restore the old path. Note that you may want to make other modifications such as adding several paths -- it would suck to have to hard code those twice once to add and once to remove. Or remove a search path element and then later restore it. Or for that matter to replace the whole search path wholesale temporarily... -- greg
В списке pgsql-hackers по дате отправления: