Re: proposal: condition blocks in psql
От | Fabien COELHO |
---|---|
Тема | Re: proposal: condition blocks in psql |
Дата | |
Msg-id | alpine.DEB.2.10.1506281004190.23688@sto обсуждение исходный текст |
Ответ на | Re: proposal: condition blocks in psql (Pavel Stehule <pavel.stehule@gmail.com>) |
Ответы |
Re: proposal: condition blocks in psql
|
Список | pgsql-hackers |
Hello again Pavel, Note that I'm not against cpp-like features on principle, I did macros for apache configurations a very long time ago, and that I only give my 0.02€ on this, for what's the € is worth these days:-) > you can use parameters for functions, but you cannot it for DO statement > (simply). Indeed. Maybe this is worth improving independently of adding conditionals. Not sure about a (clean) syntax, though... Maybe psql could export its variables somehow to PL/pgSQL. Hmmm. > the implementation of \if_version_gt is pretty simple - needs few lines of > new code. I'm curious, how many "few" lines? You would need a stack to manage nesting, you need some kind of more or less condition evaluation which is open-ended in itself, you need reading up to the end token (possibly this is more or less already available), you need adapting the prompt to reflect the nesting, you need to deal with badly nested scripts (say can an included file be "badly nested" on \i?), you need to decide what to put in the input line history, depending on the available infrastructure within psql... I would say 100-300 few lines (but I may be proven wrong both ways), all that for something which is already more or less doable with PL/pgSQL. I would rather try to upgrade the PL/pgSQL experience. -- Fabien.
В списке pgsql-hackers по дате отправления: