PostgreSQL表名(“不存在关系”,选择忽略大小写吗?

问题描述 投票:0回答:1

我一直在尝试将连接到oracle的Websphere Application Server中的应用程序耳朵迁移到PostgreSQL,

迁移后,我可以看到很多PostgreSQL表名(“关系不存在”),根据我在这里看到的内容,我看到它的原因是开发人员编写选择脚本的方式。我看到大多数解决方案是在查询过程中将表名引用为Postgres自动小写表名。但是,由于我不是创建ear文件的人,因此我可以在后端应用任何替代解决方案来忽略区分大小写的查询吗?

postgresql websphere database-migration
1个回答
0
投票
如果对象名未加引号,PostgreSQL默认情况下不区分大小写:

postgres=# \d t; Table "public.t" Column | Type | Collation | Nullable | Default --------+---------+-----------+----------+--------- x | integer | | | postgres=# select count(*) from t; count ------- 1 (1 row) postgres=# select count(*) from T; count ------- 1 (1 row)

仅在引用对象名称时区分大小写:

postgres=# select count(*) from "t"; count ------- 1 (1 row) postgres=# select count(*) from "T"; ERROR: relation "T" does not exist LINE 1: select count(*) from "T"; ^ postgres=#

AFAIK没有参数可以更改此行为。
© www.soinside.com 2019 - 2024. All rights reserved.