Home > Back-end >  What does "INSERT 0 1" mean after executing direct SQL in PostgreSQL?
What does "INSERT 0 1" mean after executing direct SQL in PostgreSQL?

Time:12-06

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.

CodePudding user response:

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).

  • Related