@@ -6,6 +6,7 @@ use crate::FdwRoutine;
6
6
use pgrx:: pg_sys:: panic:: ErrorReport ;
7
7
use pgrx:: prelude:: { Date , Timestamp , TimestampWithTimeZone } ;
8
8
use pgrx:: {
9
+ datum:: Uuid ,
9
10
fcinfo,
10
11
pg_sys:: { self , BuiltinOid , Datum , Oid } ,
11
12
AllocatedByRust , AnyNumeric , FromDatum , IntoDatum , JsonB , PgBuiltInOids , PgOid ,
@@ -47,6 +48,7 @@ pub enum Cell {
47
48
Timestamp ( Timestamp ) ,
48
49
Timestamptz ( TimestampWithTimeZone ) ,
49
50
Json ( JsonB ) ,
51
+ Uuid ( Uuid ) ,
50
52
BoolArray ( Vec < Option < bool > > ) ,
51
53
I16Array ( Vec < Option < i16 > > ) ,
52
54
I32Array ( Vec < Option < i32 > > ) ,
@@ -72,6 +74,7 @@ impl Clone for Cell {
72
74
Cell :: Timestamp ( v) => Cell :: Timestamp ( * v) ,
73
75
Cell :: Timestamptz ( v) => Cell :: Timestamptz ( * v) ,
74
76
Cell :: Json ( v) => Cell :: Json ( JsonB ( v. 0 . clone ( ) ) ) ,
77
+ Cell :: Uuid ( v) => Cell :: Uuid ( * v) ,
75
78
Cell :: BoolArray ( v) => Cell :: BoolArray ( v. clone ( ) ) ,
76
79
Cell :: I16Array ( v) => Cell :: I16Array ( v. clone ( ) ) ,
77
80
Cell :: I32Array ( v) => Cell :: I32Array ( v. clone ( ) ) ,
@@ -152,6 +155,7 @@ impl fmt::Display for Cell {
152
155
)
153
156
} ,
154
157
Cell :: Json ( v) => write ! ( f, "{:?}" , v) ,
158
+ Cell :: Uuid ( v) => write ! ( f, "{}" , v) ,
155
159
Cell :: BoolArray ( v) => write_array ( v, f) ,
156
160
Cell :: I16Array ( v) => write_array ( v, f) ,
157
161
Cell :: I32Array ( v) => write_array ( v, f) ,
@@ -179,6 +183,7 @@ impl IntoDatum for Cell {
179
183
Cell :: Timestamp ( v) => v. into_datum ( ) ,
180
184
Cell :: Timestamptz ( v) => v. into_datum ( ) ,
181
185
Cell :: Json ( v) => v. into_datum ( ) ,
186
+ Cell :: Uuid ( v) => v. into_datum ( ) ,
182
187
Cell :: BoolArray ( v) => v. into_datum ( ) ,
183
188
Cell :: I16Array ( v) => v. into_datum ( ) ,
184
189
Cell :: I32Array ( v) => v. into_datum ( ) ,
@@ -208,6 +213,7 @@ impl IntoDatum for Cell {
208
213
|| other == pg_sys:: TIMESTAMPOID
209
214
|| other == pg_sys:: TIMESTAMPTZOID
210
215
|| other == pg_sys:: JSONBOID
216
+ || other == pg_sys:: UUIDOID
211
217
|| other == pg_sys:: BOOLARRAYOID
212
218
|| other == pg_sys:: INT2ARRAYOID
213
219
|| other == pg_sys:: INT4ARRAYOID
@@ -262,6 +268,9 @@ impl FromDatum for Cell {
262
268
PgOid :: BuiltIn ( PgBuiltInOids :: JSONBOID ) => {
263
269
JsonB :: from_datum ( datum, is_null) . map ( Cell :: Json )
264
270
}
271
+ PgOid :: BuiltIn ( PgBuiltInOids :: UUIDOID ) => {
272
+ Uuid :: from_datum ( datum, is_null) . map ( Cell :: Uuid )
273
+ }
265
274
PgOid :: BuiltIn ( PgBuiltInOids :: BOOLARRAYOID ) => {
266
275
Vec :: < Option < bool > > :: from_datum ( datum, false ) . map ( Cell :: BoolArray )
267
276
}
0 commit comments