当前位置:网站首页>PostgreSQL UUID fuzzy search UUID string type conversion SQL error [42883] explicit type casts
PostgreSQL UUID fuzzy search UUID string type conversion SQL error [42883] explicit type casts
2022-07-26 07:25:00 【Jintian】
Problem description
stay postgresql In the course of using , You may have the following needs :
- Right uuid Filter columns of type , But you need to manually enter the whole uuid Too much trouble makes mistakes , If uuid It's good that columns can match as vaguely as strings
- Yes uuid Columns are directly fuzzy matched , Will report a mistake SQL Error [42883]
- Is there any way to uuid/ String type ?
- If you can convert types ,postgresql What other types are there ?
uuid Fuzzy search Variable / Column value type conversion
Right postgresql Filter a table in , Filter field is id uuid,uuid It's hard to input manually , If you can be right uuid It's good to fuzzy match the columns of type .
select * tbl_user where id = 'bf9d1fdb-d9fb-4a99-86cb-df46e2410a33';
-- Will report a mistake SQL Error [42883]
select * tbl_user where id like 'bf9d1fdb-d9fb-4a99-86cb-df46e2410a33';
-- take id The column is treated as a specified type -->character varying, Then it is actually fuzzy matching of strings
select * tbl_user where id::character varying like 'bf9d1fdb-d9fb-4a99-86cb-df46e2410a33';
-- Fuzzy matching can be used _ % Equal matching symbol .
select * tbl_user where id::character varying like 'bf9d1fdb%';
- SQL Error [42883]
org.jkiss.dbeaver.model.sql.DBSQLException: SQLException: SQL Error [42883]: ERROR: operator does not exist: uuid
-- unknow Hint: No operator matches the given name and argument types. You might need to add explicit type casts.
Form like :: data type Writing , You can set variables / Column / Value for type conversion . That is to say explicit type casts Explicit type conversion .
Quiz
select 'ddff338c-4ee2-41e7-9216-6ca9dbd03738', 'ddff338c-4ee2-41e7-9216-6ca9dbd03738'::uuid, 'ddff338c-4ee2-41e7-9216-6ca9dbd03738'::character varying ;
above SQL We'll find out 3 Column 1 The result set of rows . The problem is : What is the data type of each column ?
character string
UUID
character string
More types
Do you want to know something like this :: data type Writing , What other type names can be written ?
see https://www.postgresql.org/docs/current/datatype.html

DBeaver The screenshot of the interface will be added when free .
边栏推荐
- mysql语法(二)(纯语法)
- Compose canvas custom circular progress bar
- NFT digital collection system development: the collision of literature + Digital Collections
- 【每日一题】919. 完全二叉树插入器
- 6、MySQL数据库的备份与恢复
- 数据平台调度升级改造 | 从Azkaban 平滑过度到 Apache DolphinScheduler 的操作实践
- PR subtitle production
- It's another summer of open source. 12000 project bonuses are waiting for you!
- 此章节用于补充2
- Hcip - MPLS Technology
猜你喜欢

Become an Apache contributor, so easy!

Apache dolphin scheduler version 3.0.0-beta-1 was released, and flinksql and Zeppelin task types were added

机器学习相关比赛网站

MMOE多目标建模

数据平台调度升级改造 | 从Azkaban 平滑过度到 Apache DolphinScheduler 的操作实践

Pycharm的相关配置:改字体样式和大小、更改图片背景、更改控制台输出的字体颜色
Usage of unity3d object pool

WCF 部署在IIS上

In July, glassnode data showed that the open position of eth perpetual futures contract on deribit had just reached a one month high of $237959827.

pycharm常用快捷键
随机推荐
Data platform scheduling upgrade and transformation | operation practice from Azkaban smooth transition to Apache dolphin scheduler
pycharm常用快捷键
Countdown 2 days! Based on the cross development practice of Apache dolphin scheduler & tidb, you can greatly improve your efficiency from writing to scheduling
Embedded development: tools -- intelligent watchdog design
WCF 入门教程二
Opencv learning warp Perspective
【每日一题】919. 完全二叉树插入器
排序:归并排序和快速排序
Network Trimming: A Data-Driven Neuron Pruning Approach towards Efficient Deep Architectures论文翻译/笔记
深度学习模型部署
Apache DolphinScheduler&TiDB联合Meetup | 聚焦开源生态发展下的应用开发能力
July training (day 18) - tree
Relevant configurations of pychart: change font style and size, change picture background, and change the font color of console output
NFT digital collection system development: Huawei releases the first collector's digital collection
MySQL syntax (2) (pure syntax)
This section is intended to supplement
NFT digital collection development: Six differences between digital collections and NFT
Apache dolphin scheduler & tidb joint meetup | focus on application development capabilities under the development of open source ecosystem
NFT数字藏品系统开发:华为发布首款珍藏版数字藏品
【Keras入门日志(3)】Keras中的序贯(Sequential)模型与函数式(Functional)模型