Add support for PostgreSQL enum types in PGX datasource (#109863)
This commit is contained in:
+65
@@ -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');
|
||||
Reference in New Issue
Block a user