pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Insert results in 0 1
3+ messages / 3 participants
[nested] [flat]

* Insert results in 0 1
@ 2018-01-16 00:57  Sherman Willden <operasopranos@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Sherman Willden @ 2018-01-16 00:57 UTC (permalink / raw)
  To: pgsql-general

Computer HP Compaq 6710b
Development Platform: Ubuntu 17.10 mainly command line work
Tools: perl 5.26 and postgresql 9.6

Why do I get a 0 1 when using insert?

Thanks;

Sherman
classical=# INSERT INTO string_groups VALUES('et_b_02', 'Sonata in B
minor', 'Eroica Trio', 'Jean Baptiste Loeillet', 'Baroque');
INSERT 0 1
classical=# INSERT INTO string_groups VALUES('et_b_02', 'Sonata in B
minor', 'Eroica Trio', 'Jean Baptiste Loeillet', 'Baroque');
ERROR:  duplicate key value violates unique constraint "string_groups_pkey"
DETAIL:  Key (id)=(et_b_02) already exists.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Insert results in 0 1
@ 2018-01-16 02:13  Rob Sargent <robjsargent@gmail.com>
  parent: Sherman Willden <operasopranos@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Rob Sargent @ 2018-01-16 02:13 UTC (permalink / raw)
  To: Sherman Willden <operasopranos@gmail.com>; +Cc: pgsql-general


> On Jan 15, 2018, at 5:57 PM, Sherman Willden <operasopranos@gmail.com> wrote:
> 
> Computer HP Compaq 6710b
> Development Platform: Ubuntu 17.10 mainly command line work
> Tools: perl 5.26 and postgresql 9.6
> 
> Why do I get a 0 1 when using insert?
> 
> Thanks;
> 
> Sherman
> classical=# INSERT INTO string_groups VALUES('et_b_02', 'Sonata in B minor', 'Eroica Trio', 'Jean Baptiste Loeillet', 'Baroque');
> INSERT 0 1
> classical=# INSERT INTO string_groups VALUES('et_b_02', 'Sonata in B minor', 'Eroica Trio', 'Jean Baptiste Loeillet', 'Baroque');
> ERROR:  duplicate key value violates unique constraint "string_groups_pkey"
> DETAIL:  Key (id)=(et_b_02) already exists.
> 
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. If count is exactly one, and the target table has OIDs, then oid is the OID assigned to the inserted row. The single row must have been inserted rather than updated. Otherwise oid is zero.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Insert results in 0 1
@ 2018-01-16 05:36  Michael Paquier <michael.paquier@gmail.com>
  parent: Rob Sargent <robjsargent@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2018-01-16 05:36 UTC (permalink / raw)
  To: Rob Sargent <robjsargent@gmail.com>; +Cc: Sherman Willden <operasopranos@gmail.com>; pgsql-general

On Mon, Jan 15, 2018 at 07:13:28PM -0700, Rob Sargent wrote:
> 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. If count is
> exactly one, and the target table has OIDs, then oid is the OID
> assigned to the inserted row. The single row must have been inserted
> rather than updated. Otherwise oid is zero. 

Please refer to the documentation as well, section "Outputs":
https://www.postgresql.org/docs/current/static/sql-insert.html
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2018-01-16 05:36 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-01-16 00:57 Insert results in 0 1 Sherman Willden <operasopranos@gmail.com>
2018-01-16 02:13 ` Rob Sargent <robjsargent@gmail.com>
2018-01-16 05:36   ` Michael Paquier <michael.paquier@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox