PostgreSQL INSERT确认参数是什么意思? [英] What Do PostgreSQL INSERT confirmation params mean?

查看:90
本文介绍了PostgreSQL INSERT确认参数是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的LiveCode Server应用程序中,插入时返回了dberr,但没有明确的错误代码。

In my LiveCode Server app I'm getting a dberr returned on insertion but no explicit error code.

我在终端上手动插入了用户Postgres。

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

psql进程返回:

INSERT 0 1

这行是什么意思?除了主表外,我还有一个序列来增加主表的主键ID(int)。

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.

如果我检查数据,则插入数据,主键以1递增,并且一切正常,我不确定为什么我的应用程序返回错误(可能是应用程序或我的代码中的错误)。

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

但是如果我知道 INSERT 0 1 是什么意思,那将有助于我向自己保证:

But if I knew what INSERT 0 1 meant, that would help me assure myself that:


  1. 是,插入操作没有错误,或者

  2. 否, 0 1 表示某种错误。

  1. Yes, the insertion was done without errors, or
  2. No, the 0 1 indicates an error of some sort.

如果有人具有指向PostgreSQL文档的链接,该链接会告诉您这些内容是什么服务器响应参数是,我将研究它...我到处都看过。

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.

推荐答案

摘录自手册中的相关页面


输出

Outputs

成功完成后,INSERT命令将返回以下形式的命令标签

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

插入oid计数

计数是插入的行数。如果count恰好为1,并且目标表具有OID,则oid是分配给插入行的OID。否则,oid为零。

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.

这篇关于PostgreSQL INSERT确认参数是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆