Reputation: 1311
I tried to create a table in postgresql and insert some data into that table. However it gives error for my string literals even if I use ' or ".
Please help.
sujith=# CREATE TABLE venue (
sujith(# oid integer NOT NULL,
sujith(# id integer NOT NULL,
sujith(# name varchar[30] NOT NULL,
sujith(# _time_seq_ integer,
sujith(# _modified_by_ integer,
sujith(# _modified_on_ timestamp without time zone
sujith(# );
CREATE TABLE
sujith=# INSERT INTO VENUE (oid, id, name) values ( 0 , 1 , 'ibm' );
ERROR: malformed array literal: "ibm"
LINE 1: INSERT INTO VENUE (oid, id, name) values ( 0 , 1 , 'ibm' );
^
DETAIL: Array value must start with "{" or dimension information.
sujith=# INSERT INTO VENUE (oid, id, name) values ( 0 , 1 , "ibm" );
ERROR: column "ibm" does not exist
LINE 1: INSERT INTO VENUE (oid, id, name) values ( 0 , 1 , "ibm" );
^
sujith=#
Upvotes: 0
Views: 176
Reputation: 558
just replace the []
by ()
to solve your issue. So, replace varchar[30]
by varchar(30)
CREATE TABLE venue (
oid integer NOT NULL,
id integer NOT NULL,
name varchar(30) NOT NULL,
_time_seq_ integer,
_modified_by_ integer,
_modified_on_ timestamp without time zone );
INSERT INTO VENUE (oid, id, name) values ( 0 , 1 , 'ibm' );
Upvotes: 2