From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Дилян Палаузов <dpa-postgres(at)aegee(dot)org> |
Cc: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: psql and readline comments |
Date: | 2019-01-31 14:44:10 |
Message-ID: | 20190131144410.GE22941@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Thu, Jan 31, 2019 at 11:46:49AM +0000, Дилян Палаузов wrote:
> Hello,
>
> my reading on the correspondence so far is, that:
> - https://www.postgresql.org/docs/current/install-requirements.html states, that libedit is compatible to libreadline,
> - libreadline exports the symbol rl_variable_value(), while libedit does not
> - both libraries export rl_variable_bind()
> - for licensing reasons, sometimes psql is configured and built with support for libedit, but at runtime libreadline is
> plugged in the dynamic linker
>
> Corollary: libreadline and libedit are not 1:1 interchangable. libreadline is compatible to libedit, but not vise-
> versa.
>
> What speaks against updating the documentation, stating that if psql is configured and build against libreadline, at
> runtime it cannot use libedit? There’s in anyway no need for such exaggerated cases. And also clarify, whether
> building/configuring against libedit but running against libreadline is supported.
>
> Second approach: if psql was build and configured against libedit, then set comment-begin unconditionally (or do not set
> it).
>
> Problematic is anyway the case, when psql is build against libreadline, but executed against libedit.
>
> Third approach: call something like:
>
> char*(psql_rl_variable_value)(const char*) = dlsym(RTLD_DEFAULT, "rl_variable_value");
> //if psql_rl_variable_value is NULL, then libedit is used at runtime and not libreadline
> if (!psql_rl_variable_value || !strcmp("#", psql_rl_variable_value("comment-begin")))
> // set comment-begin if libedit is used, or .libinput does not override the default for "comment-begin"
> rl_variable_bind("comment-begin", "--");
Wow, run-time probe for the library --- interesting. I think a more
simple case would be to just unconditionally set the variable, and if
libedit is being used at run-time, nothing happens, but using
libreadline at run-time would work.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Gierth | 2019-01-31 15:04:54 | Re: psql and readline comments |
Previous Message | Bruce Momjian | 2019-01-31 14:35:58 | Re: BUG #15609: synchronous_commit=off insert performance regression with secondary indexes |