0
The name seems to be of type array, in which case it is necessary to inform the correct syntax keys are required.
INSERT INTO empresa (id, nome) VALUES(2, '{teste}')
0
1
The name seems to be of type array, in which case it is necessary to inform the correct syntax keys are required.
INSERT INTO empresa (id, nome) VALUES(2, '{teste}')
0
Literal constants:
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' ] );
0
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 length field the maximum string size.
As for the syntax of 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 one can do the following:
insert into empresa (id,nome) values (1, 'teste1'), (2, 'teste2'), ..., (n, 'testeN');
See on Sqlfiddle
Browser other questions tagged database postgresql oracle
You are not signed in. Login or sign up in order to post.
The name field is an array? if it’s gonna keys in it
– rray
you solved my problem, I always used sql server and had no idea what kind of field and quite different, I adjusted the field of the database and it worked, I had put a field of type array, did not know that this was possible
– Harry
All postgres fields have an array version, at the time create a view has the
char
and thechar[]
for example.– rray
value to tip, very grateful
– Harry