postgresql Psql错误:列“paraglider.idMaker”不存在,但它存在

jvidinwx  于 2023-01-30  发布在  PostgreSQL
关注(0)|答案(1)|浏览(139)

您好,我得到了一个查询,抛出此错误:错误:列"paraglider. idMaker"不存在

const result = await client.query('SELECT *, "maker.is" AS "maker_id", "maker.name" AS "maker_name"  FROM "paraglider" JOIN "maker" ON "paraglider.idMaker"="maker.id"');

没有排印错误
这在CLI PSQL中非常有效:

SELECT paraglider.*, 
       maker.id AS maker_id, 
       maker.name AS maker_name 
FROM paraglider 
  JOIN maker ON "idMaker"=maker.id;

我得到了这个结果:

id |  name  |   type   | release_year |  created_at   | idMaker | maker_id | maker_name 
----+--------+----------+--------------+---------------+---------+----------+------------

  1 |Tonic 2 |    all   |         2019 | time_stamp_ex |       1 |        1 | Skywalk

  2 |Arcus RS|    all   |         2017 | time_stamp_ex |       2 |        2 | Swing

我不明白为什么我的查询在PSQL的CLI中工作,但在我的代码中不工作。我尝试更改:

'ON "paraglider.idMaker"="maker.id"'

'ON "idMaker"="maker.id"'

以及ERR中的误差变化:错误:您访问的页面不存在。maker.id" does not exist.

clj7thdc

clj7thdc1#

好吧,我找到一个查询谁的工作:
SELECT paraglider.*, maker.id AS maker_id, maker.name AS maker_name FROM paraglider JOIN maker ON "idMaker"=maker.id
但不明白问题从何而来...

相关问题