user3248346
user3248346

Reputation:

Insert row into a postgresql table

I have the following table definition:

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)

I am trying to insert a row into as follows:

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

I took this command from the manual but it doesn't work. What I am doing wrong? It's a simple thing but I'm stumped. First time I am using postgres.

Upvotes: 4

Views: 1758

Answers (1)

Hexy
Hexy

Reputation: 857

Postgres uses single quotes.

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

Upvotes: 4

Related Questions