postgresql - 当名称实际上是大写时,如何使用确保表名是小写的查询?
问题描述
当名称实际上是大写时,如何使用确保表名是小写的查询?
- ERROR: relation "public.billed" does not exist
- LINE 1: SELECT count(1) FROM public.BILLED
^
- QUERY: SELECT count(1) FROM public.BILLED
- CONTEXT: PL/pgSQL function count_rows(text,text) line 7 at EXECUTE - - statement
解决方案
在 postgres 中,如果您不使用双引号,则 db 假定为小写。所以在你的情况下你需要使用
SELECT count(1) FROM public."BILLED"
推荐阅读
- javascript - 如何使用 javaScript 为所有 td 添加相同的类
- next.js - 为什么 NextApiRequestCookies, parseBody 来自 NextJS 在 'next/dist/server/api-utils'
- python - pm2 在加载机器人时崩溃。有没有办法将孤立的进程添加回它?
- r-markdown - pdf输出中的彩色列
- .net-core - 将 IHostedService 转换为微服务
- javascript - 包装异步函数的函数的 TypeScript 类型定义
- javascript - 我无法安装 npm Mac m1 Monterey
- powerbi - Power BI 运行总 DAX 计算
- python - 将python字典排序到等间隔的槽中
- sql - 返回日期减去 1 年之前的最新非空值——雪花