pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: tim.colles@ed.ac.uk
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18989: Output of \sf does not match original source for E quoted strings (unlike \df+ used to)
Date: Thu, 17 Jul 2025 09:58:44 -0400
Message-ID: <1402670.1752760724@sss.pgh.pa.us> (raw)
In-Reply-To: <18989-48eab8ec8ff535fd@postgresql.org>
References: <18989-48eab8ec8ff535fd@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> testdb=# create function test() returns text language sql begin atomic
> select E'\x12' || 'Hello World' || E'\x12'; end;
> CREATE FUNCTION

> testdb=# \sf test
> CREATE OR REPLACE FUNCTION public.test()
>  RETURNS text
>  LANGUAGE sql
> BEGIN ATOMIC
>  SELECT ((''::text || 'Hello World'::text) || ''::text);
> END

> Hence if the output of \sf is used as the source to make some amendment to
> the function the result could easily end up unintentionally different to the
> original.

[ shrug... ]  I do not see a bug here.  The control characters are
there; if your editor mangles them, that's your editor's fault.
There are a ton of related scenarios where you could fear that
non-ASCII characters might get mangled during query editing.
If we tried to prevent them all, we'd make the editing experience
less pleasant not more so.

Personally I'd probably write chr(12) instead of what you did here.

			regards, tom lane





view thread (2+ messages)

Message-ID: <1402670.1752760724@sss.pgh.pa.us>
Permalink:  ../1402670.1752760724@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1402670.1752760724@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, tim.colles@ed.ac.uk, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18989: Output of \sf does not match original source for E quoted strings (unlike \df+ used to)
  In-Reply-To: <1402670.1752760724@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox