暂无图片
openggauss创建自定义函数报错。
我来答
分享
Renduy
2023-03-29
openggauss创建自定义函数报错。

我在3.0.0企业版本上创建自定义函数时,报如下错误。

Begin  
return i + 1;  
END;  
$$ LANGUAGE plpgsql;  
ERROR: autonomous transaction failed to create autonomous session  
DETAIL: could not connect to server: Operation now in progress  
Is the server running on host "localhost" (::1) and accepting  
TCP/IP connections on port 5432?  
could not connect to server: Operation now in progress  
Is the server running on host "localhost" (127.0.0.1) and accepting  
TCP/IP connections on port 5432?

复制
我来答
添加附件
收藏
分享
问题补充
7条回答
默认
最新
DarkAthena

给一下pull和启动这个docker的命令

暂无图片 评论
暂无图片 有用 0
打赏 0
暂无图片
Renduy
题主
2023-03-29
我是在k8s集群上通过yaml文件启动的opengauss服务,镜像用的是官网下载的openGauss_3.0.0 分布式镜像中的的镜像。
Renduy
题主
2023-03-29
我查看了postgresql.conf文件,发现监听的地址没有 localhost 。不知道是不是和这个有关系 listen_addresses = '192.168.2.196' # what IP address(es) to listen on; # comma-separated list of addresses; # defaults to 'localhost'; use '*' for all # (change requires restart)
DarkAthena
答主
2023-03-30
改成 星号 吧
Renduy

少粘贴了几行,完整的函数定义如下(官网的例子):

omm=# CREATE OR REPLACE FUNCTION func_increment_plsql(i integer) RETURNS integer AS $$
omm$# begin
omm$#  return i + 1;
omm$# end;
omm$# $$ LANGUAGE plpgsql;
复制
暂无图片 评论
暂无图片 有用 1
打赏 0
DarkAthena

这个问题是在3.0版本中,增加了dbe_pldeveloper功能导致的。
在开启了plsql_show_all_error这个参数后,只要创建pl对象,就会走一个自治事务,将这个对象的代码插入到dbe_pldeveloper这个schema下面的表中。但这个自治事务,是又走了一次连接数据库的流程,而且写的是通过localhost进行连接,那么操作系统上的hosts里,也必须要维护localhost(操作系统默认一般是有localhost的,除非改过)

所以,避免这个报错的方式有两种,

  1. 关闭plsql_show_all_error,但这样就没有dbe_pldeveloper的功能了
  2. 操作系统里设置一下localhost
暂无图片 评论
暂无图片 有用 1
打赏 0
Renduy
题主
2023-03-29
感谢大佬指导。 我查了一下参数,这个参数目前设置的是off postgres=> select name, setting from pg_settings where name = 'plsql_show_all_error'; name | setting ----------------------+--------- plsql_show_all_error | off (1 row)
Renduy
题主
2023-03-29
尝试了方式1 无论把这个参数改为 on 或者 off 问题依然存在。 对于第二种方式,我是在容器中运行的数据库,不知道如何验证一下,还请大佬再指导下。
Renduy

我是在容器中启动的opengauss

# Kubernetes-managed hosts file.
127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
fe00::0 ip6-mcastprefix
fe00::1 ip6-allnodes
fe00::2 ip6-allrouters
192.168.1.90    db1-deployment-df949654d-c24mj

复制
暂无图片 评论
暂无图片 有用 0
打赏 0
Renduy

发现这个markdown有点问题 代码块第一行总被忽略 需要手动敲个换行

bash-4.2$ cat /etc/hosts
# Kubernetes-managed hosts file.
127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
fe00::0 ip6-mcastprefix
fe00::1 ip6-allnodes
fe00::2 ip6-allrouters
192.168.1.90    db1-deployment-df949654d-c24mj


复制
暂无图片 评论
暂无图片 有用 0
打赏 0

opengauss创建函数,存储过程等,需要修改pg_hba.conf,增加

host all all 127.0.0.1/32 trust

暂无图片 评论
暂无图片 有用 0
打赏 0

listen_addresses = '*'

然后重启生效

暂无图片 评论
暂无图片 有用 0
打赏 0
回答交流
Markdown


请输入正文
提交
相关推荐
来一套openGauss安装指南
回答 1
已采纳
https://blog.csdn.net/GXL1012/article/details/126776787
opengauss中物理备份是热备热恢复吗,影响业务吗?
回答 2
支持
opengauss的字段值,有办法改参数设为大小写不敏感吗
回答 2
MySQL兼容性下,字段值大小写敏感建表时使用如下选项:utf8mb4generalci/utf8mb4bin
关于 openGauss ,运维人员可以自定义AI策略吗?
回答 1
可以,但需要有一些python经验,后面会更加便于自行配置。
请问一下 opengauss 不支持 C 的 window 函数吗
回答 2
例如在postgis中的CREATEORREPLACEFUNCTIONSTClusterDBSCAN(geometry,epsfloat8,minpointsint)RETURNSintAS'$lib
出现postgres$#是怎么回事?为什么接下来输入什么都没有反应了?该怎么退出这个?
回答 1
尝试\q或者ctrlz不行使用kill杀掉gsql进程
“极致RTO”、“并行恢复”与“备机可读”的关系是什么?
回答 1
RTO指的是可以中断或关闭多少时间而不会对业务造成重大损害。所以极致是说几乎不中断。备机可读,就是镜像库可以提供服务。最早oracle的dg是备机读的时候不能同步,同步时候不能读。后来11g的时候ad
opengauss是不能通过可视化界面建表嘛?
回答 1
datastudio确定可以可视化建表,你的问题可能不在工具上面
openGauss和PG的差异对比主要有哪些?
回答 1
pg是进程架构。opengauss是线程架构。pg有第三方插件可用。opengauss禁用第三方插件。可以参考下这篇文章openGauss与PostgreSQL的对比
用mtk oracle向opengauss迁移报错
回答 1
报错截图发出来看看