| From: | Florents Tselai <florents(dot)tselai(at)gmail(dot)com> |
|---|---|
| To: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
| Cc: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>, Lauri Siltanen <lauri(dot)siltanen(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Feature: psql - display current search_path in prompt |
| Date: | 2025-10-25 04:38:58 |
| Message-ID: | CA+v5N40zVNkm_+rsT_+zAk6mjVye-8-Vn4YDzuBCe0M7vBp9Eg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri, Oct 24, 2025 at 5:20 PM Nathan Bossart <nathandbossart(at)gmail(dot)com>
wrote:
> On Fri, Oct 24, 2025 at 05:10:13PM +0300, Florents Tselai wrote:
> > Good catch. v2 attached
>
> Thanks.
>
> + <varlistentry id="app-psql-prompting-S">
> + <term><literal>%S</literal></term>
> + <listitem><para>The current search path.</para></listitem>
> + </varlistentry>
>
> I'd suggest linking to a page about the search_path [0].
>
Done
>
> +extern const char *session_search_path(void);
>
> This function appears to be unused.
>
> + /*
> + * Distinguish unknown (NULL) from
> an empty but valid search_path ("").
> + * If not connected or older
> server doesn't report it via ParameterStatus,
> + * show "?".
> + */
> + if (!pset.db ||
> PQparameterStatus(pset.db, "search_path") == NULL)
> + strlcpy(buf, "?",
> sizeof(buf));
> + else
> + strlcpy(buf,
> PQparameterStatus(pset.db, "search_path"), sizeof(buf));
> + break;
>
> Shouldn't we move most of this logic to session_search_path() and use it
> here?
>
Yes
| Attachment | Content-Type | Size |
|---|---|---|
| v3-0001-psql-Add-S-prompt-escape-to-display-current-searc.patch | application/octet-stream | 3.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Akshay Joshi | 2025-10-25 05:57:54 | Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement |
| Previous Message | Thomas Munro | 2025-10-25 03:21:28 | Re: C11: should we use char32_t for unicode code points? |