将行插入postgresql表

时间:2016-08-22 02:07:35

标签: postgresql

我有以下表格定义:

Email Extension Plugin v2.47
    JUnit Plugin v1.2-beta-4 is older than required. To fix, install v1.2 or later.
GitHub plugin v1.20.0
    Jenkins Git plugin v2.4.0 failed to load. Fix this plugin first.
Jenkins Git plugin v2.5.3
    Matrix Project Plugin v1.4.1 is older than required. To fix, install v1.6 or later.
    Jenkins Mailer Plugin v1.11 is older than required. To fix, install v1.16 or later.
Pipeline v2.2
    Pipeline: Basic Steps v2.0 failed to load. Fix this plugin first.
Jenkins Workspace Cleanup Plugin v0.30
    Matrix Project Plugin v1.4.1 is older than required. To fix, install v1.7.1 or later.
GitHub Branch Source Plugin v1.8.1
    Jenkins Git plugin v2.3 failed to load. Fix this plugin first.
Pipeline: Basic Steps v2.1
    Jenkins Mailer Plugin v1.11 is older than required. To fix, install v1.13 or later.
GitHub Organization Folder Plugin v1.4
    GitHub Branch Source Plugin v1.5 failed to load. Fix this plugin first.

我正在尝试按如下方式插入一行:

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)

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

1 个答案:

答案 0 :(得分:1)

Postgres使用单引号。

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