Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "INSERT 0 1" mean after executing direct SQL in PostgreSQL?

When I execute a file containing SQL commands with psql -f, I get output like this (truncated):

CREATE DOMAIN
CREATE TABLE
CREATE TABLE
INSERT 0 1
INSERT 0 1
INSERT 0 1

What do the numbers 0 and 1 mean? (I think 1 is the number of rows modified. But 0?) I can't find it in PostgreSQL's official documentation or anywhere else.

like image 784
ByteEater Avatar asked Dec 13 '25 19:12

ByteEater


1 Answers

This is documented with the INSERT command

On successful completion, an INSERT command returns a command tag of the form

INSERT oid count

The count is the number of rows inserted or updated. oid is always 0 (it used to be the OID assigned to the inserted row if count was exactly one and the target table was declared WITH OIDS and 0 otherwise, but creating a table WITH OIDS is not supported anymore).


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!