1

I have connected to my remote postgres db via: https://stackoverflow.com/a/65310225/5065796

I am able to query and interact just fine. I cannot, however, see the prompt. It's just a blank line. It looks like this:

\c
You are now connected to database "yourdb" as user "youruser".
| <-- my cursor is here

I've read all over and the usual response is that there's a problem with the sql prompt regexp. No combination of any of the following, including restarting the connection, and even restarting Emacs, produces any prompt.

; spaces on the end
(sql-set-product-feature 'postgres :prompt-regexp "^[-[:alnum:]_]*=[#>] ")
(sql-set-product-feature 'postgres :prompt-cont-regexp "^[-[:alnum:]_]*=[#>] ")

(sql-set-product-feature 'postgres :prompt-regexp "^\\(?:\\sw\\|\\s_\\|-\\)*=[#>] ")
(sql-set-product-feature 'postgres :prompt-cont-regexp "^\\(?:\\sw\\|\\s_\\|-\\)*[-(][#>] ")

; no spaces on the end
(sql-set-product-feature 'postgres :prompt-regexp "^[-[:alnum:]_]*=[#>]")
(sql-set-product-feature 'postgres :prompt-cont-regexp "^[-[:alnum:]_]*=[#>]")

(sql-set-product-feature 'postgres :prompt-regexp "^\\(?:\\sw\\|\\s_\\|-\\)*=[#>]")
(sql-set-product-feature 'postgres :prompt-cont-regexp "^\\(?:\\sw\\|\\s_\\|-\\)*[-(][#>]")

Each change is reflected in the sql-product-alist. For instance, the last calls to sql-set-product-feature appear as:

(postgres :name "Postgres" :free-software t :font-lock sql-mode-postgres-font-lock-keywords :sqli-program sql-postgres-program :sqli-options sql-postgres-options :sqli-login sql-postgres-login-params :sqli-comint-func sql-comint-postgres :list-all
           ("\\d+" . "\\dS+")
           :list-table
           ("\\d+ %s" . "\\dS+ %s")
           :completion-object sql-postgres-completion-object :prompt-regexp "^\\(?:\\sw\\|\\s_\\|-\\)*=[#>]" :prompt-length 12 :prompt-cont-regexp "^\\(?:\\sw\\|\\s_\\|-\\)*[-(][#>]" :input-filter sql-remove-tabs-filter :terminator
           ("\\(^\\s-*\\\\g\\|;\\)" . "\\g"))

I have loaded psql in a non-Emacs prompt and connected. Taking the various prompts, things like,

AB_CDE_FG=>
aoeu=>

I have run regexp-builder using the above expressions and they match.

So, if it's not the prompt regexp, what could it be?

Lorem Ipsum
  • 4,327
  • 2
  • 14
  • 35

0 Answers0