From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Michael R. Mauger" Newsgroups: gmane.emacs.devel Subject: Re: Patch for sql.el (quote table names in sql-list-table) Date: Fri, 29 Jan 2016 22:31:31 -0700 (MST) Message-ID: <1454131891215-385718.post@n5.nabble.com> References: <87egd274so.fsf@ahungry.com> <1454016205681-385599.post@n5.nabble.com> <8737th6qms.fsf@ahungry.com> <87y4b95bop.fsf@ahungry.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1454131927 19953 80.91.229.3 (30 Jan 2016 05:32:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 30 Jan 2016 05:32:07 +0000 (UTC) To: Emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 30 06:31:57 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aPO8Y-0006S3-8U for ged-emacs-devel@m.gmane.org; Sat, 30 Jan 2016 06:31:54 +0100 Original-Received: from localhost ([::1]:37640 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPO8X-0003X6-2x for ged-emacs-devel@m.gmane.org; Sat, 30 Jan 2016 00:31:53 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPO8J-0003Wo-LH for Emacs-devel@gnu.org; Sat, 30 Jan 2016 00:31:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aPO8G-0003Yo-Ce for Emacs-devel@gnu.org; Sat, 30 Jan 2016 00:31:39 -0500 Original-Received: from mbob.nabble.com ([162.253.133.15]:63794) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPO8G-0003Yb-6n for Emacs-devel@gnu.org; Sat, 30 Jan 2016 00:31:36 -0500 Original-Received: from msam.nabble.com (unknown [162.253.133.85]) by mbob.nabble.com (Postfix) with ESMTP id 833DB1F8ABF8 for ; Fri, 29 Jan 2016 21:26:51 -0800 (PST) In-Reply-To: <87y4b95bop.fsf@ahungry.com> X-detected-operating-system: by eggs.gnu.org: iOS iPhone or iPad X-Received-From: 162.253.133.15 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:199023 Archived-At: Matthew Carter-3 wrote > Matthew Carter < > m@ > > writes: > > Attached is an alternate patch which at least fixes the postgres > completion list to quote both the schema and table names (I can't think > of a situation in which it would hurt for this to be quoted). > > > diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el > index 65e94ba..fd59f46 100644 > --- a/lisp/progmodes/sql.el > +++ b/lisp/progmodes/sql.el > @@ -4948,8 +4948,8 @@ Try to set `comint-output-filter-functions' like > this: > ;; 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)))) > + (format "\"%s\"" (cadr tbl)) > + (format "\"%s\".\"%s\"" (car tbl) (cadr tbl)))) > cl)))) > I think this is a better approach. Ultimately, I'd like to make the quotation conditional on the name string having an unusual character would force the quoting. For now I'd say this is probably the correct step that will make completion work in your use case. Thank you. Feel free to apply the change. Michael R. Mauger -- View this message in context: http://emacs.1067599.n5.nabble.com/Patch-for-sql-el-quote-table-names-in-sql-list-table-tp385543p385718.html Sent from the Emacs - Dev mailing list archive at Nabble.com.