更新名称中包含点 (.) 的 PostgreSQL 列

问题描述

我应该更新一行的值,但列名有点。

我尝试了 name.name 但什么也没有,尽管它似乎在 MysqL 上工作。

如何使用 postgresql?我发誓,在创建此线程之前,我已经搜索了所有内容

谢谢

更新: 感谢您的快速回答,我尝试使用“”,但结果是

ERROR:  column "name.name" of relation "my_table" does not exist

我的查询

update my_table set "name.name"='a081613e-2e28-4cae-9ff7-4eaa9c918352';

解决方法

用双引号将名称括起来:"name.name"

更新:

更新:感谢您的快速回答,我尝试使用“”,但结果是这样

你确定这是你的情况吗?

psql (13.2)
Type "help" for help.

postgres=# CREATE DATABASE example_db;
CREATE DATABASE
postgres=# \c example_db
You are now connected to database "example_db" as user "postgres".
example_db=# CREATE TABLE example_table ("example.field" int);
CREATE TABLE
example_db=# \d example_table
               Table "public.example_table"
    Column     |  Type   | Collation | Nullable | Default
---------------+---------+-----------+----------+---------
 example.field | integer |           |          |

example_db=# SELECT "example.field" FROM example_table;
 example.field
---------------
(0 rows)

example_db=# SELECT "example_table"."example.field" FROM example_table;
 example.field
---------------
(0 rows)

example_db=#
,

您可以在列名周围使用 ""

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...