1
1

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 5 years have passed since last update.

INSERT実行によるエラーメモ(PostgreSQL)

Last updated at Posted at 2019-10-22

はじめに

 SQLを実行中に様々なエラーが発生したのでメモを書きます。私のような初心者の方に少しでも役に立てばよいなと思います。

invalid input syntax for type integer

 int型で定義してい列に、他の型(varchar型など)の値をINSERTすると発生します。

malformed array literal

 意味は「不正な形式の配列リテラル」です。
 私の場合は、配列を入れると誤って定義した列に、通常の値をINSERTしようとした際に発生しました。CREATE TABLE文でvarchar(20)と書くべきところをvarchar[20]と書いていました。

Array value must start with "{" or dimension information.

 意味は「配列の値は必ず"{"または次元情報から始めなければならない。」という意味です。上記の「malformed array literal」の詳細情報として表示されていました。

column "apple" does not exist

 意味は「"apple"列はありません」です。
 ただし私の場合は以下のINSERT文を入力したときに発生しました。これでエラーが発生したのは'apple'書かなければならないところを"apple"と書いていたためでした。文字列は必ずシングルクウォーテーション「'」で囲うようにします。

postgres=# insert into fruits values ("apple");

おわりに

また何かエラーが発生した場合にはここに追記していこうと思います。

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?