django - 为什么我无法对现有的 postgres 数据库表执行 SQL 查询?
问题描述
出于学习目的,我最近在我的 Django 项目中将我的数据库从 SQLite 迁移到了 postgres,并且成功了。
我可以通过以下命令连接到数据库
sudo -u <username> psql -d <DB_name>;
我能够列出包括架构的表:
\d
但是当我尝试查询简单的选择查询时,它给出了以下错误:
select * from public.AUTHENTICATION_userprofile;
ERROR: relation "public.authentication_userprofile" does not exist
LINE 1: select * from public.AUTHENTICATION_userprofile;
表详细信息:
Schema | Name | Type | Owner
--------+-----------------------------------+----------+----------
public | AUTHENTICATION_userprofile | table | postgres
public | AUTHENTICATION_userprofile_id_seq | sequence | postgres
请有任何建议。
谢谢
解决方案
由于您使用大写字母创建了表,因此 Postgres 将对此表区分大小写,您必须在查询中加上双引号:
select * from public."AUTHENTICATION_userprofile";
推荐阅读
- python - 如何从 Shopify Python API 获取所有客户数据?
- php - WooCommerce 输入选择不采用默认值
- javascript - 如何使用 AWS-SDK 上传文件(来自 Base64)?
- php - 如何在另一个页面中获取数组值取决于我的复选框?
- caffeine - 咖啡因缓存,仅在放置成功时才执行过期元素的驱逐
- node.js - Meteor Mup 失败 - npm install --unsafe-perm 返回一个非零代码:1
- python - 从 xml 模式中提取一组元素
- mongodb - 通过以'hh:mm A'格式附加时间来修改所有文档的字段
- python - Kivy GUI 冻结
- python - 如何在生成器中包装返回连续值的函数?