From: Matthew Carter <m@ahungry.com>
To: emacs-devel@gnu.org
Subject: Re: Patch for sql.el (quote table names in sql-list-table)
Date: Thu, 28 Jan 2016 21:55:39 -0500 [thread overview]
Message-ID: <8737th6qms.fsf@ahungry.com> (raw)
In-Reply-To: <1454016205681-385599.post@n5.nabble.com> (Michael R. Mauger's message of "Thu, 28 Jan 2016 14:23:25 -0700 (MST)")
"Michael R. Mauger" <michael@mauger.com> writes:
> I'd discourage this change. The List Tables prompt does not prevent use of
> identifier enclosing characters and by not using them you get the default
> case conversion behavior. There are also cases with MS SQL Server where the
> enclosing character is not a single character but rather a [ and ] pair.
>
> I'd also be concerned when I ask to list the table in another schema since
> we'd now be enclosing the schema and table name within the quotes which is
> clearly not what we want.
>
>
>
> --
> View this message in context: http://emacs.1067599.n5.nabble.com/Patch-for-sql-el-quote-table-names-in-sql-list-table-tp385543p385599.html
> Sent from the Emacs - Dev mailing list archive at Nabble.com.
>
The original problem/issue I had with this arised from the following
function in sql.el (the one that generates the postgres completion
candidate list):
(defun sql-postgres-completion-object (sqlbuf schema)
....<snip>....
;; Return the list of table names (public schema name can be omitted)
(mapcar #'(lambda (tbl)
(if (string= (car tbl) "public")
(cadr tbl)
(format "%s.%s" (car tbl) (cadr tbl))))
cl))))
As you can see, in a schema that includes tables with spaces in their
names, those become completion objects ("Foo Bar" for instance,
sans quotes of course).
When something that then goes to make use of the completion list tries
to pass along "Foo Bar" (sans quotes) to the function that I
patched, it causes an issue.
With a little modification, my original patch could account for
differing open/close quotations as you referenced (and the patch itself
does nothing if the quotation feature is not set).
Do you think a better fix would be to quote the postgres completion list
when necessary? (if a space in one of the table names is found)?
Because as it is, it doesn't work well with some completion modes like
helm (which just display the completion list candidates verbatim, and
expect the user to press RET on one of them to select it).
--
Matthew Carter (m@ahungry.com)
http://ahungry.com
next prev parent reply other threads:[~2016-01-29 2:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-28 3:37 Patch for sql.el (quote table names in sql-list-table) Matthew Carter
2016-01-28 21:23 ` Michael R. Mauger
2016-01-29 2:55 ` Matthew Carter [this message]
2016-01-29 3:03 ` Matthew Carter
2016-01-30 5:31 ` Michael R. Mauger
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=8737th6qms.fsf@ahungry.com \
--to=m@ahungry.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).