--On Donnerstag, April 10, 2008 22:48:24 +0100 Gregory Stark <[EMAIL PROTECTED]> wrote:

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.

Als already mentioned in the original thread, excluding backslash commands from aliasing
isn't a big deal, but this would negate the usefulness of this feature.


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"?


aliases are substituted only once within a call. They are acting exactly the same way you'll find on your favorite shell. If the current patch doesn't, it needs to be adressed, of course. Have you tried your examples on the current patch? Retesting shows it works as expected...

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?

Since aliases are simple substitutions nothing different. Multiple commands are placed directly into the query buffer, so nothing different than the current behavior should happen. Again, do you have any concrete examples?


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??

Hmm? What happens if you are going to change your encoding within multiple backslash commands now?



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.

So i do.

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.

Again, it's text _substitution_, replacing the very first token with another token. Wether this token can be complex or not is another question, but of course, i'm not so foolish to describe psql as turing complete language.

--
 Thanks

                   Bernd

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to