我需要创建货币符号列,并尝试将其保存为具有Unicode值的字节,但是我在数据库管理器(Intellij(中看到它是原始代码,而不是实际的符号字符。什么是最好的,可以接受的方法?
我必须错过整个点,因为我只会:
x=# with utf(sign,currency) as (values(e'u20BD','Rubble'),(e'u20AC','Euro'),(e'u20AF','Drachma'))
select *,pg_typeof(sign) from utf;
sign | currency | pg_typeof
------+----------+-----------
₽ | Rubble | text
€ | Euro | text
₯ | Drachma | text
(3 rows)
UTF代码从https://www.w3schools.com/charsets/ref_utf_currency.asp
最初也希望使用Postgres内部货币类型,因为它将标志放在正确的位置(金额之前或之后(,但在印地语语言环境中失败了:
x=# set lc_monetary TO 'hi_IN';
ERROR: invalid value for parameter "lc_monetary": "hi_IN"
Time: 0.332 ms
x=# set lc_monetary TO 'EN_ie';
SET
Time: 0.514 ms
x=# select 1::money;
money
-------
€1.00
(1 row)
Time: 3.313 ms
x=# set lc_monetary TO 'RU_ru';
SET
Time: 10.178 ms
x=# select 1::money;
money
-----------
1,00 руб.
(1 row)