2016-08-22 6 views
0

I가 다음과 같은 테이블 정의 :행 삽입

foo=# \d+ tag 
                 Table "public.tag" 
    Column |   Type   |     Modifiers      | Storage | Stats target | Description 
-------------+------------------------+--------------------------------------------------+----------+--------------+------------- 
id   | integer    | not null default nextval('tag_id_seq'::regclass) | plain |    | 
name  | character varying(255) | not null           | extended |    | 
version  | integer    | not null           | plain |    | 
description | character varying(255) | not null           | extended |    | 
active  | boolean    | not null           | plain |    | 
Indexes: 
    "tag_pkey" PRIMARY KEY, btree (id) 
    "unique_tag" UNIQUE CONSTRAINT, btree (name, version) 

나는 다음과 같이에 행을 삽입하려고 :

foo=# insert into tag (name, version, description, active) values ("scala", 1, "programming language", true); 
ERROR: column "scala" does not exist 
LINE 1: ... tag (name, version, description, active) values ("scala", 1... 

내가 수동 그러나 그것을에서이 명령을했다 작동하지 않습니다. 내가 뭘 잘못하고 있니? 그것은 간단한 일이지만 나는 혼란 스럽다. 처음에는 포스트그레스를 사용하고 있습니다.

+0

리터럴에는 작은 따옴표를 사용하십시오. – klin

답변

1

Postgres는 작은 따옴표를 사용합니다.

insert into tag (name, version, description, active) values ('scala', 1, 'programming language', true); 
+0

dammit postgres! –

+1

@ Mika'il은 postgres와 덜 관련이 있으며 ansi sql과 더 관련이 있습니다 ... – donkopotamus