Re: BUG #18829: RAISE NOTICE appends 's' to string in PostgreSQL 17.2

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: armandnortjee(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18829: RAISE NOTICE appends 's' to string in PostgreSQL 17.2
Date: 2025-03-02 16:10:07
Message-ID: bdc1b820-f711-4749-8595-99aad004718a@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


On 2025-03-02 Su 9:18 AM, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference: 18829
> Logged by: Armand
> Email address:armandnortjee(at)gmail(dot)com
> PostgreSQL version: 17.2
> Operating system: Windows 10
> Description:
>
> In PostgreSQL 17.2, when using the RAISE NOTICE command with a string
> variable, the output incorrectly appends an extra 's' to the string value.
> This issue does not occur when running the same code in earlier PostgreSQL
> versions (e.g., PostgreSQL 16).
>
> DO $$
> DECLARE
> my_var TEXT := 'garth';
> BEGIN
> RAISE NOTICE '%s is slim', my_var;
> END
> $$;
>
> Expected Result:
> The output should be:
> NOTICE: garth is slim
>
> Actual Result:
> The output incorrectly shows:
> NOTICE: garths is slim
>

This is not a bug, it's working as documented.

The 's' is there because you told it to be there. The docs say: "Inside
the format string, |%| is replaced by the string representation of the
next optional argument's value."

This is not a printf style format string, as you appear to think it is.

cheers

andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Treat 2025-03-02 18:59:28 Re: BUG #18829: RAISE NOTICE appends 's' to string in PostgreSQL 17.2
Previous Message Tom Lane 2025-03-02 16:09:47 Re: BUG #18829: RAISE NOTICE appends 's' to string in PostgreSQL 17.2