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

推荐订阅源

WordPress大学
WordPress大学
T
Threatpost
阮一峰的网络日志
阮一峰的网络日志
美团技术团队
F
Fortinet All Blogs
The GitHub Blog
The GitHub Blog
月光博客
月光博客
V
Visual Studio Blog
T
Tailwind CSS Blog
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
Jina AI
Jina AI
J
Java Code Geeks
Martin Fowler
Martin Fowler
大猫的无限游戏
大猫的无限游戏
Recorded Future
Recorded Future
C
Check Point Blog
腾讯CDC
N
Netflix TechBlog - Medium
aimingoo的专栏
aimingoo的专栏
罗磊的独立博客
Hacker News: Ask HN
Hacker News: Ask HN
SecWiki News
SecWiki News
博客园 - Franky
Hacker News - Newest:
Hacker News - Newest: "LLM"
N
News | PayPal Newsroom
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security @ Cisco Blogs
W
WeLiveSecurity
The Last Watchdog
The Last Watchdog
Cloudbric
Cloudbric
F
Full Disclosure
The Cloudflare Blog
Y
Y Combinator Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
S
Schneier on Security
Schneier on Security
Schneier on Security
Spread Privacy
Spread Privacy
L
LINUX DO - 热门话题
AI
AI
N
News and Events Feed by Topic
T
Tor Project blog
P
Palo Alto Networks Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
G
Google Developers Blog

博客园 - 星小梦

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/