1.

postgresql执行结束后,判断结果是否成功,有几种结果

typedef enum
{
PGRES_EMPTY_QUERY = 0, /* empty query string was executed */
PGRES_COMMAND_OK, /* a query command that doesn't return
* anything was executed properly by the
* backend */
PGRES_TUPLES_OK, /* a query command that returns tuples was
* executed properly by the backend, PGresult
* contains the result tuples */
PGRES_COPY_OUT, /* Copy Out data transfer in progress */
PGRES_COPY_IN, /* Copy In data transfer in progress */
PGRES_BAD_RESPONSE, /* an unexpected response was recv'd from the
* backend */
PGRES_NONFATAL_ERROR, /* notice or warning message */
PGRES_FATAL_ERROR, /* query failed */
PGRES_COPY_BOTH, /* Copy In/Out data transfer in progress */
PGRES_SINGLE_TUPLE /* single tuple from larger resultset */
} ExecStatusType;

成功并不只有一个,第一个是查询空的正确返回,第二个是没有返回值的正确返回(比如insert,update),第三个是查询有返回值的正确返回(比如select)

2.

用c++访问postgresql的时候,需要使用官方的libpq库,目前调查下来,这个libpq库是postgresql数据库编译出来时配对的。也就是不能像mysql一样,数据库是64位安装,可以自己编译32的connector访问。所以市面上的postgresql的connector都是在原生的libpq的基础上封装的。也就导致一个问题,就是安装什么样的postgresql,就会配戴什么样的connector。最大的影响就是数据库是32位还是64位,如果是64位,那么自己的程序也必须是64位,因为不可能在不同平台下相互访问lib库。并且从官方的release来看,postgresql从11.4开始就没有32位的发布了。所以,如果想用postgresql的话,最好尽早着手把自己的程序替换成64位

3.

查看postgresql的配置

SELECT * from pg_show_all_settings()

4.

mysql中有一个默认配置,就是空闲连接超时后自动kill掉,默认好像是8小时
postgresql中也有这个属性,默认是不主动kill,也就是关闭的,如果你需要可以打开,不过对于后端开发,这样更方便,避免了自己写keepalive的逻辑了

idle_in_transaction_session_timeout (integer)

Terminate any session with an open transaction that has been idle for longer than the specified duration in milliseconds. This allows any locks held by that session to be released and the connection slot to be reused; it also allows tuples visible only to this transaction to be vacuumed. See Section 24.1 for more details about this.

The default value of 0 disables this feature.

5.

如果navicat连接远程的postgresql的时候报这个错误

no pg_hba.conf entry for host ssl off

那是因为postgresql默认是不允许外部连接的

所以需要修改安装目录下的pg_hba.conf文件

# IPv4 local connections:
host    all             all             127.0.0.1/32            md5

修改成

host    all             all             0.0.0.0/0            md5

这个文档上面有介绍,0.0.0.0/0表示允许所有ip

然后在开始菜单postgresql安装的目录下找到sql shell

运行

select pg_reload_conf();

重新加载配置,注意一定要加分号

6.

用navicat数据传输postgresql数据库的数据的时候,如果报下面的错误

column p.proisagg does not exist atabase d on d.datname = current_database() perhaps you meant to reference the column

表示你的工具太老了,我用的postgresql是11.4,navicat是12.0.18,需要下载最新的navicat 12.1.x

navicate破解

破解的github地址

https://github.com/Deltafox79/Navicat_Keygen

  • 下载编译
  • 安装最新的navicat
  • 把编译出来的exe拷贝到navicat的目录,不拷贝也可以,就是到时候需要自己选择一下目录
  • 运行破解软件
  • 默认选项基本上不用改,对应好自己的版本,唯一有一点注意,我们下载的应该都是中文版的,languages选择中文
  • 点击patch
  • 提示navicat.exe-x64->cracked,表示成功
  • 然后打开navicat
  • 点击注册
  • 点击破解软件serial keygen一行的generate生成注册码,然后把生成的注册码拷贝到navicat
  • 点击激活,然后选择手动激活
  • 然后把navicat的请求码拷贝到破解软件的required code中
  • 点击activation code下面的generate
  • 把activation code中的内容复制到navicat的激活码中
  • 点击激活

可以参考

https://www.52pojie.cn/thread-867986-1-1.html

最新文章

  1. iOS 关于版本升级问题的解决
  2. 完成端口CreateIoCompletionPort编写高性能的网络模型程序
  3. Python基础(9)--正则表达式
  4. [转] C#中绘制矢量图形
  5. 第三百四十六天 how can I 坚持
  6. HTTP重定向服务器
  7. 【转】perl如何避免脚本在windows中闪一下就关闭
  8. C# String.Format大全
  9. android脚步--Relativelayout设置
  10. 2017年要学习的JavaScript的顶级框架和主题
  11. Zkui安装
  12. 64位Win10系统安装Mysql5.7.11
  13. Jenkins+VS项目持续集成
  14. dubbo服务运行的三种方式
  15. jdbcTemplate 调用存储过程。 入参 array 返回 cursor
  16. Shell学习之结合正则表达式与通配符的使用(五)
  17. C# 封装SqlHelper
  18. Understanding ABI Files
  19. SQL注入之Sqli-labs系列第二十关(基于头部的cookie POST报错注入)
  20. SecureCRT乱码解决

热门文章

  1. 利用kibana学习 elasticsearch restful api (DSL)
  2. .net 中访问config的一些方式
  3. Winform c# 多线程处理实例
  4. 2019 浩德钢圈java面试笔试题 (含面试题解析)
  5. 二、NodeJS入门——准备工作(2)——MongoDB安装以及客户端Robomongo安装和使用
  6. 开发工具--PyCharm
  7. 轻量级.Net ORM SqlSuger项目实战
  8. html5表单上传控件Files筛选指定格式的文件:accept属性过滤excel文件
  9. 使用Nginx对Websocket进行反向代理
  10. django 权限设置-菜单显示