bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#22016: 25.0.50; sql-interactive-mode prompts and header alignment in


From: Phil Sainty
Subject: bug#22016: 25.0.50; sql-interactive-mode prompts and header alignment in query output
Date: Thu, 10 Oct 2019 10:50:39 +1300
User-agent: Orcon Webmail

Hi Lars, Michael,

On 2019-10-09 18:22, Lars Ingebrigtsen wrote:
Michael sent a control message marking this bug as
unreproducible/moreinfo under the subject "Close bugs", but didn't
actually close the bug reports.  I'm not quite sure what Michael's
intentions were -- Michael, did you want the bug reporter to supply
more information, or did you mean that this bug had been fixed?

Looking at this again... `sql-interactive-remove-continuation-prompt'
used in `comint-preoutput-filter-functions' is presumably intended to
take care of this very problem; and that pre-dates this bug report.

So there may well have been some other contributing factor responsible
for it not working in my case.

The first thing that springs to mind is that the default postgres
prompt regexps do not recognise hyphens, so I was also modifying those
patterns to recognise my hyphenated database names.

The current sql.el postgres defaults are:

     :prompt-regexp "^[[:alnum:]_]*=[#>] "
     :prompt-cont-regexp "^[[:alnum:]_]*[-(][#>] "

My config has:

;; Default postgres pattern was: "^\\w*=[#>] " (see `sql-product-alist').
    (setq sql-prompt-regexp "^\\(?:\\sw\\|\\s_\\|-\\)*=[#>] ")
    ;; Ditto for continuation prompt: "^\\w*[-(][#>] "
    (setq sql-prompt-cont-regexp "^\\(?:\\sw\\|\\s_\\|-\\)*[-(][#>] "))

I then have the following notes:

    ;; Allow symbol chars and hyphens in database names in prompt.
    ;; TODO: Try to make this *strictly* accurate, in accordance with:
;; http://www.postgresql.org/docs/current/interactive/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
    ;; (and then submit the fix upstream).  (hmm... hyphens are not
    ;; actually mentioned in that documentation :/ )
    ;;
    ;; SQL identifiers and key words must begin with a letter (a-z,
    ;; but also letters with diacritical marks and non-Latin letters)
    ;; or an underscore (_). Subsequent characters in an identifier or
    ;; key word can be letters, underscores, digits (0-9), or dollar
    ;; signs ($). Note that dollar signs are not allowed in
    ;; identifiers according to the letter of the SQL standard, so
    ;; their use might render applications less portable. The SQL
    ;; standard will not define a key word that contains digits or
    ;; starts or ends with an underscore, so identifiers of this form
    ;; are safe against possible conflict with future extensions of
    ;; the standard.
    ;;
    ;; The system uses no more than NAMEDATALEN-1 bytes of an
    ;; identifier; longer names can be written in commands, but they
    ;; will be truncated. By default, NAMEDATALEN is 64 so the maximum
    ;; identifier length is 63 bytes. If this limit is problematic, it
    ;; can be raised by changing the NAMEDATALEN constant in
    ;; src/include/pg_config_manual.h.


Tracing my own config changes, I can see that I supported symbol chars
in `sql-prompt-regexp' before other changes, however I seemingly
didn't fix this in `sql-prompt-cont-regexp' until the same commit in
which I added my filter.

Potentially that means all I'd ever really needed was for both prompt
regexps to be compatible, but I would need to do some more testing to
figure this out.

It looks like the postgres prompt regexps are still a going concern
for sql.el itself, so that could be up for discussion in the meantime.


-Phil






reply via email to

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