将行插入postgresql表

4
我有以下表定义:
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...

我从手册中取出了这个命令,但它不起作用。我做错了什么?这是一件简单的事情,但我被难住了。这是我第一次使用postgres。

在字面值中使用单引号。 - klin
1个回答

4

Postgres使用单引号。

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接