昆仑资源网 Design By www.lawayou.com
我就废话不多说了,大家还是直接看代码吧~
SELECT sum(aa) as "recordNumber" FROM table SELECT sum(aa) as recordNumber FROM table
postgis查询字段是将字段字段转为小写,如果需要大写的字符,需要加双引号
补充:Postgresql中表名、列名、用户名大小写问题
注意:是双引号,单引号可能会被解析成普通字符,因而是不识别的字段
highgo=# create table "ExChange" (id int); CREATE TABLE highgo=# create table ExChange (id int); CREATE TABLE highgo=# \d List of relations Schema | Name | Type | Owner ----------------+----------+-------+-------- oracle_catalog | dual | view | highgo public | ExChange | table | highgo public | exchange | table | highgo public | myt | table | highgo public | t1 | table | highgo public | tran | table | highgo (6 rows) highgo=# insert into exchange values (1); INSERT 0 1 highgo=# insert into "ExChange" values (2); INSERT 0 1 highgo=# select * FROM exchange ; id ---- 1 (1 row) highgo=# select * FROM ExChange ; id ---- 1 (1 row) highgo=# select * FROM "ExChange" ; id ---- 2 (1 row) highgo=# insert into ExChange values (2); INSERT 0 1 highgo=# select * FROM "ExChange" ; id ---- 2 (1 row) highgo=# select * FROM exchange ; id ---- 1 2 (2 rows)
> 从上面可以看出,如果不加双引号,那么表名都会被转化为小写。如果想要大小写混用,需要添加双引号。
highgo=# create table exchange (ID int,id int); ERROR: 42701: column "id" specified more than once highgo=# create table exchange (ID int,name text); CREATE TABLE highgo=# select id from exchange ; id ---- (0 rows) highgo=# select ID from exchange ; id ---- (0 rows) highgo=# select "ID" from exchange ; ERROR: 42703: column "ID" does not exist LINE 1: select "ID" from exchange ; highgo=# \d exchange Table "public.exchange" Column | Type | Modifiers --------+---------+----------- id | integer | name | text | highgo=# \du List of roles Role name | Attributes | Member of -----------+------------------------------------------------------------+----------- aaa | | {} gpadmin | Superuser, Create role, Create DB | {} highgo | Superuser, Create role, Create DB, Replication, Bypass RLS | {} replica | Replication | {} highgo=# create table AAA; ERROR: 42601: syntax error at or near ";" LINE 1: create table AAA; ^ highgo=# create user AAA; ERROR: 42710: role "aaa" already exists highgo=# create user "AAA"; CREATE ROLE highgo=# \du List of roles Role name | Attributes | Member of -----------+------------------------------------------------------------+----------- AAA | | {} aaa | | {} gpadmin | Superuser, Create role, Create DB | {} highgo | Superuser, Create role, Create DB, Replication, Bypass RLS | {} replica | Replication | {}
实验证明,字段与用户同样会被自动转化为小写,除非添加双引号。 其实最好的办法就是全部用小写,这样才能尽量减少问题的出现。
以上为个人经验,希望能给大家一个参考,也希望大家多多支持。如有错误或未考虑完全的地方,望不吝赐教。
昆仑资源网 Design By www.lawayou.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
昆仑资源网 Design By www.lawayou.com
暂无评论...
P70系列延期,华为新旗舰将在下月发布
3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。
而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?
根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。