unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Steve Purcell <steve@sanityinc.com>
To: emacs-devel <emacs-devel@gnu.org>, bruce.connor.am@gmail.com
Subject: Re: sql-interactive-mode not recognising psql prompts
Date: Tue, 9 Feb 2016 21:12:41 +1300	[thread overview]
Message-ID: <AE8A4DBD-EAE5-46F9-95AC-563903EAF0A1@sanityinc.com> (raw)
In-Reply-To: <CAAdUY-LZwhndH36yj8H2S7qdXgzydyWFijOr3gGBDjwsar_X4A@mail.gmail.com>

On 9 Feb 2016, at 09:16, Artur Malabarba <bruce.connor.am@gmail.com> wrote:
> 
> On 8 Feb 2016 5:05 pm, "Steve Purcell" <steve@sanityinc.com> 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	other threads:[~2016-02-09  8:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-08  7:54 (unknown) steve
2016-02-08  8:01 ` (unknown) Steve Purcell
2016-02-08 12:56 ` Artur Malabarba
2016-02-08 19:05   ` Re: Steve Purcell
2016-02-08 20:16     ` Re: Artur Malabarba
2016-02-09  8:12       ` Steve Purcell [this message]
2016-02-12  0:52         ` sql-interactive-mode not recognising psql prompts Michael R. Mauger
2016-02-15 12:49           ` Artur Malabarba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AE8A4DBD-EAE5-46F9-95AC-563903EAF0A1@sanityinc.com \
    --to=steve@sanityinc.com \
    --cc=bruce.connor.am@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).