惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Schneier on Security
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
D
DataBreaches.Net
F
Full Disclosure
腾讯CDC
博客园 - 【当耐特】
MyScale Blog
MyScale Blog
Stack Overflow Blog
Stack Overflow Blog
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
SegmentFault 最新的问题
The Register - Security
The Register - Security
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
J
Java Code Geeks
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Privacy International News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
A
Arctic Wolf
Scott Helme
Scott Helme
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tor Project blog
博客园 - 三生石上(FineUI控件)
Know Your Adversary
Know Your Adversary
AWS News Blog
AWS News Blog
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
CERT Recently Published Vulnerability Notes
O
OpenAI News
Project Zero
Project Zero
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Application and Cybersecurity Blog
Application and Cybersecurity Blog
云风的 BLOG
云风的 BLOG
N
News and Events Feed by Topic
MongoDB | Blog
MongoDB | Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
Cisco Talos Blog
Cisco Talos Blog
P
Palo Alto Networks Blog
Schneier on Security
Schneier on Security

博客园 - 星小梦

Linux系统调整java程序启动用户,导出xlsx时抛出Permission denied异常问题。 vue2的devtools开发工具卡死现象的解决方法 echarts图表在浏览器上打印出现裁剪的问题 apache echarts数据点重影或 Cannot read properties of undefined (reading 'type')错误问题 yarn install出现error Error: certificate has expired异常 git多代码仓库合并的方式 docker容器oshi如何获取宿主机的运行状态信息? su命令引起的nohup进程以root身份启动导致的问题 docker-compose启动服务,影响其他服务的原因 xxl-job provider netty_http server caught exception flutter升级导致的旧项目的运行环境问题排查记录 vue3插件库以及对JSX的支持。 JSX、TSX扩展语法学习材料 commitlint Lint 提交消息格式控制 Chromium历史版本下载方式 Window10 关闭Edge浏览器的多选项卡通过Alt+Tab组合键切换的方式 Postgres16数据库集成外部库dblink和postgres_fdw扩展的方式 java 泛型类型如何保留类型的信息的方式 docker镜像安装字体支持,解决jdk服务验证码生成找不到字体问题 window和Linux命令行执行多条命令的方法
Postgres16 常见问题
星小梦 · 2025-07-18 · via 博客园 - 星小梦

input file appears to be a text format dump. Please use psql

https://stackoverflow.com/questions/40632228/input-file-appears-to-be-a-text-format-dump-please-use-psql

How force pg_dump to (not) include scheme name for each objects in DDL

https://stackoverflow.com/questions/58146760/how-force-pg-dump-to-not-include-scheme-name-for-each-objects-in-ddl?utm_source=chatgpt.com

ERROR: could not determine data type of parameter $1

https://stackoverflow.com/questions/56089400/postgres-sql-could-not-determine-data-type-of-parameter-by-hibernate
着重的说一下这个情况。
先说下我这边的环境:
postgres 16版本
springboot 3

出现这个问题一般是由于配置的jdbc连接导致的问题。
首先检查stringtype参数是否配置为stringtype=unspecified了,如果配置的话,请去掉这个再尝试下。

stringtype解释(这在postgresql的JDBC手册中有解释):
指定绑定通过 setString() 设置的 PreparedStatement 参数时使用的类型。如果 stringtype 设置为 VARCHAR(默认),此类参数将作为 varchar 参数发送到服务器。如果 stringtype 被设置为 unspecified,参数将以无类型值的形式发送到服务> 器,服务器将尝试推断出适当的类型。如果现有应用程序使用 setString() 来设置实际上是其他类型(如整数)的参数,并且无法更改应用程序以使用适当的方法(如 setInt()),则此方法非常有用。

如果你因为某些情况不能去掉或者不想去掉的话,那么有几种方式可以让你的SQL正常运行:
第一种就是在SQL语句(这里使用Mybatis的XML文件举例)中的占位符处添加类型转换,
#{name}::varchar这种的,当然cast函数进行类型转换也可以,他们是等同的作用,
举例:
``

select * from user where username = #{username}::varchar;

这个SQL运行着就没有问题,因为加上了::varchar类型转换。

上面SQL这个情况即使不加类型转换,也不会报错,因为PG数据库会隐式的转换。

第二种就是使用了函数,函数里又使用了占位符。
如:

select * from user where username = concat('%', #{username}, '%');

这个sql运行后就会出现上述的错误信息。因为#{}里的值会在PG解析式修改为?, 而?占位符处的值类型在绑定占位符值的期间postgre数据库不知道(因为在jdbc连接处定义了stringtype=unspecified参数)。
需要改成以下这种方式才能运行:

select * from user where username = concat('%', #{username}::varchar, '%');
select * from user where username = '%' || #{username} || '%';

引用

https://jdbc.postgresql.org/
https://postgresql.org/