Re: Separate psql commands from arguments
От | Gregory Stark |
---|---|
Тема | Re: Separate psql commands from arguments |
Дата | |
Msg-id | 87lk3l8jpz.fsf@oxford.xeocode.com обсуждение исходный текст |
Ответ на | Re: Separate psql commands from arguments (Decibel! <decibel@decibel.org>) |
Ответы |
Re: Separate psql commands from arguments
Re: Separate psql commands from arguments |
Список | pgsql-hackers |
"Decibel!" <decibel@decibel.org> writes: > Am Samstag, 5. April 2008 schrieb Gregory Stark: >> On Apr 10, 2008, at 7:50 AM, Peter Eisentraut wrote: >>> I also don't see any point in allowing aliases which call other psql >>> commands. > > Why disallow it? I think it could be very useful. Well I feel like storing a query and resending it later is something predictable which will work reliably. Storing a psql input line and reinterpreting it later is surely going to cause weird things to happen. Just for some examples off the top of my head, what happens if I define an alias "\foo" which consists of "\foo" and call it? What happens if I have mutually recursive aliases? What happens if I define "\foo" to run \ followed by its first argument, and I pass it "foo"? What happens if I pass it "unalias foo"? What happens if you press C-c during an alias, does it keep running subsequent commands? What if the editor returns an error after a \e command? What about if a \i command doesn't find the file? What happens to aliases when you change the encoding in the middle of running one? Actually, come to think of it, what *does* happen to aliases when the encoding changes?? Basically it sounds like you're treating psql as if it was a well defined language with well defined syntax and semantics. And I don't think it is. It's just one big if-else-if block with lots of strcmps. There's no infrastructure to parse or manage a stack of calls to functions. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com Get trained by Bruce Momjian - ask me about EnterpriseDB'sPostgreSQL training!
В списке pgsql-hackers по дате отправления: