emacs-devel
[Top][All Lists]
Advanced

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

Re: Patch for sql.el (quote table names in sql-list-table)


From: Michael R. Mauger
Subject: Re: Patch for sql.el (quote table names in sql-list-table)
Date: Fri, 29 Jan 2016 22:31:31 -0700 (MST)

 

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.



reply via email to

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