0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PostgreSQLで列がないと言われたときの対処法

Posted at

Postgreで列がないと言われる

今までMySQLを使用しており、Postgreを触り始めて2日目のことです。
列がないとのエラーに悩まされます。
いや…あるんやけど…(T T)

スクリーンショット 2021-04-10 142037.png

スクリーンショット 2021-04-10 142120.png
※テーブルの中身は無視してくださいww

調べた事

エラーメッセージ的にidがダメっぽい。
MySQLではAUTO_INCREMENTを使っていましたが、Postgreで初めてserial型を使用しました。
これが原因なのか?と思い自動連番の指定がおかしいかもと調べる。

原因

エラーメッセージの通り、***「movieidはないけど、movieIDを参照したいっぽいよ」***ということでした。
Postgreは大文字小文字を区別しているので、そんな列ないよっということでした。

そして、movieIDで判断してほしいなら、””を付ければOK!

スクリーンショット 2021-04-10 143240.png

解決!

参考

この記事を読んだら一発で解決でした笑
ありがとうございます。
https://buralog.jp/postgresql-relation-does-not-exist-error/

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?