5

[postgresql] 表查询错误 psycopg2.errors.UndefinedTable

 3 years ago
source link: https://www.v2ex.com/t/795454
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  程序员

[postgresql] 表查询错误 psycopg2.errors.UndefinedTable

  Outliver0 · 1 天前 · 228 次点击

1.png 如上图,因为数据表创建时表名有大写字母,所以查询的时候加双引号,我试过不加双引号、加单引号、加反引号等各种方法,报的错都是同一个,网上的解决方案也都加双引号解决,来问问有遇到过相似情况的没,帮忙解决一下;

-- Table: Infos.User_Info

-- DROP TABLE "Infos"."User_Info";

CREATE TABLE "Infos"."User_Info"
(
    id integer NOT NULL,
    name "char",
    age integer,
    CONSTRAINT "User_Info_pkey" PRIMARY KEY (id)
)

TABLESPACE pg_default;

ALTER TABLE "Infos"."User_Info"
    OWNER to postgres;

使用的时 python 的 psycopg2,python 版本 3.9.4


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK