-1

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

我试过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';
4

2 回答 2

0

用双引号将名称括起来:"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=#
于 2021-04-26T07:42:16.740 回答
0

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

于 2021-04-26T07:42:19.830 回答