BUG #17736: when psql -c is used, the $ sign is escaped

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: dafoer_x(at)163(dot)com
Subject: BUG #17736: when psql -c is used, the $ sign is escaped
Date: 2023-01-04 02:48:28
Message-ID: 17736-3a11fa0232fb6593@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 17736
Logged by: dafoer_x
Email address: dafoer_x(at)163(dot)com
PostgreSQL version: 14.0
Operating system: centos
Description:

[pg14(at)VM-219-249-centos ~]$ psql -d postgres -p 29822 -h 127.0.0.1 -c "set
lc_monetary='en_US.UTF-8'; drop table if exists t_mony; create table
t_mony(c1 bigint,c2 money); insert into t_mony values(2,'$1.00'); select *
from t_mony;"
c1 | c2
----+-------
2 | $0.00
(1 row)

postgres=# set lc_monetary='en_US.UTF-8'; drop table if exists t_mony;
create table t_mony(c1 bigint,c2 money); insert into t_mony
values(2,'$1.00'); select * from t_mony;
SET
DROP TABLE
CREATE TABLE
INSERT 0 1
c1 | c2
----+-------
2 | $1.00
(1 row)

Because $ is escaped, the results are different when the same command is
executed in psql and internally.
I would like to ask how to solve this problem, or why there is this
difference?

Regards

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message John Naylor 2023-01-04 13:34:23 Re: BUG #17736: when psql -c is used, the $ sign is escaped
Previous Message Alex Richman 2023-01-03 12:56:33 Re: Segfault while creating logical replication slots on active DB 14.6-1 + 15.1-1