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

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

Problem Description:

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.

Solution – 1

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

Rate this post
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept
Reject