I have an error message, I tried several options of not getting a solution. Is there a missing configuration?
The name seems to be of type array, in this case you need to inform the correct syntax keys are required.
INSERT INTO empresa (id, nome) VALUES(2, '{teste}')
I believe that at the time of creating the field you have used Character Varing[]
which is an array of varchars (or an array of dynamic strings). The correct field, if you want to create only 1 string, is Character Varing
and in the field length the maximum string size.
As for the syntax of the insert, if there is more than one command in the query each of them must end with ";". In your case:
insert into empresa (id,nome) values (2,'teste');
select * from empresa;
But if there are several inserts you can do the following:
insert into empresa (id,nome) values (1, 'teste1'), (2, 'teste2'), ..., (n, 'testeN');
See SQLFiddle
Literal constant expressions:
INSERT INTO empresa ( id, nome ) VALUES ( 1, '{ testeA, testeB, testeC }'::text[] );
Expressions with ARRAY
:
INSERT INTO empresa ( id, nome ) VALUES ( 1, ARRAY[ 'testeA', 'testeB', 'testeC' ] );