Add support for PostgreSQL enum types in PGX datasource (#109863)

This commit is contained in:
Zoltán Bedi
2025-09-05 20:24:54 +02:00
committed by GitHub
parent e2913815d3
commit 8e8c36203f
4 changed files with 87 additions and 8 deletions
@@ -0,0 +1,65 @@
// 🌟 This was machine generated. Do not edit. 🌟
//
// Frame[0] {
// "typeVersion": [
// 0,
// 0
// ],
// "executedQueryString": "SELECT * FROM tbl WHERE current_mood = 'happy';"
// }
// Name:
// Dimensions: 2 Fields by 1 Rows
// +-----------------+--------------------+
// | Name: name | Name: current_mood |
// | Labels: | Labels: |
// | Type: []*string | Type: []*string |
// +-----------------+--------------------+
// | Moe | happy |
// +-----------------+--------------------+
//
//
// 🌟 This was machine generated. Do not edit. 🌟
{
"status": 200,
"frames": [
{
"schema": {
"meta": {
"typeVersion": [
0,
0
],
"executedQueryString": "SELECT * FROM tbl WHERE current_mood = 'happy';"
},
"fields": [
{
"name": "name",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "current_mood",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
}
]
},
"data": {
"values": [
[
"Moe"
],
[
"happy"
]
]
}
}
]
}
@@ -0,0 +1,18 @@
-- SELECT * FROM tbl WHERE current_mood = 'happy';
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1
FROM pg_type
WHERE typname = 'mood'
) THEN
CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy');
END IF;
END$$;
CREATE TEMPORARY TABLE tbl (
name text,
current_mood mood
);
INSERT INTO tbl VALUES ('Moe', 'happy');