In my LiveCode Server app I'm getting a dberr returned on insertion but no explicit error code.
I went on a terminal and did the insertion by hand as user Postgres.
%My_Dbase=# INSERT INTO new-table (first_name, last_name, anonymous) VALUES ('batman', 'Moonboy', TRUE);
The psql process returns:
INSERT 0 1
What does this line mean? Besides the primary table I also have a sequence to increment the primary key ID (int) of the main table.
If I check the data, the data is inserted, the primary key is increment by one and everything seems fine, I'm not sure why my app is returning an error (could be a bug in the app or my code).
But if I knew what INSERT 0 1
meant, that would help me assure myself that:
0 1
indicates an error of some sort.If anyone has a link to the PostgreSQL doc which tells what these server response params are, I will study it... I have looked everywhere.
In an INSERT , the data available to RETURNING is the row as it was inserted. This is not so useful in trivial inserts, since it would just repeat the data provided by the client. But it can be very handy when relying on computed default values.
Single row INSERTs In the same region on AWS with lets say 1ms latency, this number can go up to ~500 INSERTs per second.
You must have INSERT privilege on a table in order to insert into it. If ON CONFLICT DO UPDATE is present, UPDATE privilege on the table is also required. If a column list is specified, you only need INSERT privilege on the listed columns.
The answer for this simple case is: "Yes".
Excerpt from the relevant page in the manual:
Outputs
On successful completion, an INSERT command returns a command tag of the form
INSERT oid count
The count is the number of rows inserted. If count is exactly one, and the target table has OIDs, then oid is the OID assigned to the inserted row. Otherwise oid is zero.
EDIT: I've been pointed at the documentation for this, https://www.postgresql.org/docs/14/protocol-message-formats.html
The format is COMMAND
OID
ROWS
.
As OIDs system columns are not supported anymore, OID is always zero.
So what you are seeing is that you've done an insert, the OID was zero, and one row was inserted.
So in other words, your command is completing successfully!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With