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

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

bug#40564: 28.0.50; sql.el should add support PostgreSQL alias "postgres


From: Michael Mauger
Subject: bug#40564: 28.0.50; sql.el should add support PostgreSQL alias "postgresql" of "postgres"
Date: Sun, 26 Apr 2020 02:15:34 +0000

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, April 25, 2020 10:01 AM, Stefan Kangas <stefan@marxist.se> wrote:

> Hi Michael,
>
> Could you please take a look at the below bug report? Thanks in advance.
>
> stardiviner numbchild@gmail.com writes:
>
> > Emacs built-in sql.el mode "sql-mode" is used by many extra extensions. 
> > Like Org
> > Mode's "ob-sql.el" and ejc-sql (https://github.com/kostafey/ejc-sql) etc.
> > Here is a discussion
> > (https://lists.gnu.org/archive/html/emacs-orgmode/2020-01/msg00347.html) of 
> > add
> > alias "postgresql" for "postgres" which comes from `sql-product-alist'.
> > And in ejc-sql I got this issue again because `sql-set-product' invoked in 
> > ejc-sql
> > but has no match of "postgresql" in`sql-product-alist' caused error.
> > So I hope sql.el can support "postgresql" name alias in `sql-product-alist'.

>From private emails concerning this issue last month:

* The user can add a copy of the `posgtgres' sql-mode product settings as 
`postgresql`
  easily from their own init.el:

    (let ((pg (cdr (assq 'postgres sql-product-alist))))  ; Make a copy of the 
postgres plist
      (add-to-list 'sql-product-alist                     ; Add as a new entry 
under postgresql
                   (cons 'postgresql (plist-put pg :name "PostgreSQL"))))

  Basically copy the `postgres' entry in `sql-product-alist' and add it as 
`postgresql'.

* Based on my understanding of this issue, I believe that this not a feature 
appropriate
  for sql-mode, but rather it represents a weakness in the EJC->SQL mapping. 
Sql.el has
  used `postgres' as the identifier of the PostgreSQL since the first commit in 
'99. It
  was exposed as a user visible variable in `sql-product-alist' in 2003. EJC is 
using a
  heuristic that may work for other products, but it definitely won't work for 
all (It is
  broken for EJC's `sqlserver', which is `ms' in sql.el).

123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789

  I have an opinion as to how it should be solved in EJC but I do not have a 
patch to offer.

  The `ejc-get-product-name` function, in ejc-lib.sql, is specifically for 
fetching
  the `sql-product' based on the EJC product identification.  I recommend that 
this function
  first look up a :sql-product attribute for the EJC product and then fall-back 
on the heuristic
  it now uses. The product attributes are defined in `ejc-connect-interactive' 
and passed to
  `ejc-create-connection'. I also recommend the definition of product 
attributes be pulled out
  to a user visible global variable so that users could control settings.

I believe that is is not a failure on sql.el's part and that it is more 
properly addressed in EJC.
I am also reluctant to add cruft to sql.el to support a package outside of the 
Emacs/ELPA source
repository because I am unable to build automated tests of the desired feature 
and be assured
nothing has broken.

--
MICHAEL@MAUGER.COM // FSF and EFF member // GNU Emacs sql.el maintainer





reply via email to

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