emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sql-interactive-mode not recognising psql prompts


From: Steve Purcell
Subject: Re: sql-interactive-mode not recognising psql prompts
Date: Tue, 9 Feb 2016 21:12:41 +1300

On 9 Feb 2016, at 09:16, Artur Malabarba <address@hidden> wrote:
> 
> On 8 Feb 2016 5:05 pm, "Steve Purcell" <address@hidden> wrote:
> > Yes, possibly. And in fact :alnum: would be better than :alpha:, of course…
> >
> > And since the rules for database names are probably much the same as for 
> > other SQL identifiers, there’s a chance \\s (symbol constituent) would work 
> > too.
> 
> Yes. I'm not familiar with the fine details of SQL syntax, but \\w\\|\\s is 
> generally a better bet than just \\w.
> 


The pathological case is pretty bad, in fact:

   createdb " foo bar "

works and creates a prompt such as " foo bar =#”.

According to the relevant section postgres manual [1], pretty much any 
characters are valid in a database name. So we can choose between matching 
“reasonable” database names with a tight regexp, e.g. one beginning 
“^[[:alnum:]_]*”, or matching all allowable names with a permissive regexp 
which will likely match all sorts of spurious output. I’d suggest the former, 
and will attach a patch to that effect to issue 22596.


[1] 
http://www.postgresql.org/docs/current/interactive/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS


reply via email to

[Prev in Thread] Current Thread [Next in Thread]