pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: dafoer_x@163.com
Subject: BUG #17736: when psql -c is used, the $ sign is escaped
Date: Wed, 04 Jan 2023 02:48:28 +0000
Message-ID: <17736-3a11fa0232fb6593@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      17736
Logged by:          dafoer_x
Email address:      dafoer_x@163.com
PostgreSQL version: 14.0
Operating system:   centos
Description:        

[pg14@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



view thread (2+ messages)  latest in thread

Message-ID: <17736-3a11fa0232fb6593@postgresql.org>
Permalink:  ../17736-3a11fa0232fb6593@postgresql.org/
Also on:    postgresql.org/message-id/17736-3a11fa0232fb6593@postgresql.org

 · 

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: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, dafoer_x@163.com
  Subject: Re: BUG #17736: when psql -c is used, the $ sign is escaped
  In-Reply-To: <17736-3a11fa0232fb6593@postgresql.org>

* 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