@@ -2896,7 +2896,6 @@ func TestWireTypes(t *testing.T) {
28962896 },
28972897 {
28982898 Name : "TIMETZ returning binary format" ,
2899- Skip : true , // TODO: CI uses a different time zone, need to homogenize them somehow for testing
29002899 SetUpScript : []string {
29012900 "CREATE TABLE test (v1 TIMETZ, v2 TIMETZ);" ,
29022901 "INSERT INTO test VALUES ('0:0', '04:05:06.789'), ('09:27 PM', '12:12');" ,
@@ -2978,6 +2977,340 @@ func TestWireTypes(t *testing.T) {
29782977 },
29792978 },
29802979 },
2980+ {
2981+ Name : "TIMESTAMP returning text format" ,
2982+ SetUpScript : []string {
2983+ "SET datestyle TO 'Postgres, MDY';" ,
2984+ "CREATE TABLE test (v1 TIMESTAMP, v2 TIMESTAMP);" ,
2985+ "INSERT INTO test VALUES ('2020-01-12 00:00:00', '2021-02-13 04:05:06.789'), ('2022-03-14 10:11:12', '2023-04-15 11:12:13');" ,
2986+ },
2987+ Assertions : []WireScriptTestAssertion {
2988+ {
2989+ Send : []pgproto3.FrontendMessage {
2990+ & pgproto3.Parse {
2991+ Name : "stmt_name" ,
2992+ Query : "SELECT * FROM test ORDER BY v1 NULLS FIRST;" ,
2993+ },
2994+ & pgproto3.Describe {
2995+ ObjectType : 'S' ,
2996+ Name : "stmt_name" ,
2997+ },
2998+ & pgproto3.Sync {},
2999+ },
3000+ Receive : []pgproto3.BackendMessage {
3001+ & pgproto3.ParseComplete {},
3002+ & pgproto3.ParameterDescription {ParameterOIDs : []uint32 {}},
3003+ & pgproto3.RowDescription {
3004+ Fields : []pgproto3.FieldDescription {
3005+ {
3006+ Name : []byte ("v1" ),
3007+ TableOID : 0 ,
3008+ TableAttributeNumber : 1 ,
3009+ DataTypeOID : 1114 ,
3010+ DataTypeSize : 8 ,
3011+ TypeModifier : - 1 ,
3012+ Format : 0 ,
3013+ },
3014+ {
3015+ Name : []byte ("v2" ),
3016+ TableOID : 0 ,
3017+ TableAttributeNumber : 2 ,
3018+ DataTypeOID : 1114 ,
3019+ DataTypeSize : 8 ,
3020+ TypeModifier : - 1 ,
3021+ Format : 0 ,
3022+ },
3023+ },
3024+ },
3025+ & pgproto3.ReadyForQuery {TxStatus : 'I' },
3026+ },
3027+ },
3028+ {
3029+ Send : []pgproto3.FrontendMessage {
3030+ & pgproto3.Bind {
3031+ DestinationPortal : "" ,
3032+ PreparedStatement : "stmt_name" ,
3033+ ParameterFormatCodes : nil ,
3034+ Parameters : nil ,
3035+ ResultFormatCodes : []int16 {0 },
3036+ },
3037+ & pgproto3.Execute {},
3038+ & pgproto3.Close {
3039+ ObjectType : 'P' ,
3040+ },
3041+ & pgproto3.Sync {},
3042+ },
3043+ Receive : []pgproto3.BackendMessage {
3044+ & pgproto3.BindComplete {},
3045+ & pgproto3.DataRow {
3046+ Values : [][]byte {
3047+ []byte (`Sun Jan 12 00:00:00 2020` ),
3048+ []byte (`Sat Feb 13 04:05:06.789 2021` ),
3049+ },
3050+ },
3051+ & pgproto3.DataRow {
3052+ Values : [][]byte {
3053+ []byte (`Mon Mar 14 10:11:12 2022` ),
3054+ []byte (`Sat Apr 15 11:12:13 2023` ),
3055+ },
3056+ },
3057+ & pgproto3.CommandComplete {CommandTag : []byte ("SELECT 2" )},
3058+ & pgproto3.CloseComplete {},
3059+ & pgproto3.ReadyForQuery {TxStatus : 'I' },
3060+ },
3061+ },
3062+ },
3063+ },
3064+ {
3065+ Name : "TIMESTAMP returning binary format" ,
3066+ SetUpScript : []string {
3067+ "CREATE TABLE test (v1 TIMESTAMP, v2 TIMESTAMP);" ,
3068+ "INSERT INTO test VALUES ('2020-01-12 00:00:00', '2021-02-13 04:05:06.789'), ('2022-03-14 10:11:12', '2023-04-15 11:12:13');" ,
3069+ },
3070+ Assertions : []WireScriptTestAssertion {
3071+ {
3072+ Send : []pgproto3.FrontendMessage {
3073+ & pgproto3.Parse {
3074+ Name : "stmt_name" ,
3075+ Query : "SELECT * FROM test ORDER BY v1 NULLS FIRST;" ,
3076+ },
3077+ & pgproto3.Describe {
3078+ ObjectType : 'S' ,
3079+ Name : "stmt_name" ,
3080+ },
3081+ & pgproto3.Sync {},
3082+ },
3083+ Receive : []pgproto3.BackendMessage {
3084+ & pgproto3.ParseComplete {},
3085+ & pgproto3.ParameterDescription {ParameterOIDs : []uint32 {}},
3086+ & pgproto3.RowDescription {
3087+ Fields : []pgproto3.FieldDescription {
3088+ {
3089+ Name : []byte ("v1" ),
3090+ TableOID : 0 ,
3091+ TableAttributeNumber : 1 ,
3092+ DataTypeOID : 1114 ,
3093+ DataTypeSize : 8 ,
3094+ TypeModifier : - 1 ,
3095+ Format : 0 ,
3096+ },
3097+ {
3098+ Name : []byte ("v2" ),
3099+ TableOID : 0 ,
3100+ TableAttributeNumber : 2 ,
3101+ DataTypeOID : 1114 ,
3102+ DataTypeSize : 8 ,
3103+ TypeModifier : - 1 ,
3104+ Format : 0 ,
3105+ },
3106+ },
3107+ },
3108+ & pgproto3.ReadyForQuery {TxStatus : 'I' },
3109+ },
3110+ },
3111+ {
3112+ Send : []pgproto3.FrontendMessage {
3113+ & pgproto3.Bind {
3114+ DestinationPortal : "" ,
3115+ PreparedStatement : "stmt_name" ,
3116+ ParameterFormatCodes : nil ,
3117+ Parameters : nil ,
3118+ ResultFormatCodes : []int16 {1 },
3119+ },
3120+ & pgproto3.Execute {},
3121+ & pgproto3.Close {
3122+ ObjectType : 'P' ,
3123+ },
3124+ & pgproto3.Sync {},
3125+ },
3126+ Receive : []pgproto3.BackendMessage {
3127+ & pgproto3.BindComplete {},
3128+ & pgproto3.DataRow {
3129+ Values : [][]byte {
3130+ {0 , 2 , 62 , 228 , 207 , 3 , 128 , 0 },
3131+ {0 , 2 , 94 , 46 , 160 , 114 , 138 , 136 },
3132+ },
3133+ },
3134+ & pgproto3.DataRow {
3135+ Values : [][]byte {
3136+ {0 , 2 , 125 , 41 , 171 , 38 , 208 , 0 },
3137+ {0 , 2 , 156 , 92 , 204 , 93 , 29 , 64 },
3138+ },
3139+ },
3140+ & pgproto3.CommandComplete {CommandTag : []byte ("SELECT 2" )},
3141+ & pgproto3.CloseComplete {},
3142+ & pgproto3.ReadyForQuery {TxStatus : 'I' },
3143+ },
3144+ },
3145+ },
3146+ },
3147+ {
3148+ Name : "TIMESTAMPTZ returning text format" ,
3149+ SetUpScript : []string {
3150+ "SET datestyle TO 'Postgres, MDY';" ,
3151+ "CREATE TABLE test (v1 TIMESTAMPTZ, v2 TIMESTAMPTZ);" ,
3152+ "INSERT INTO test VALUES ('2020-01-12 00:00:00 PST', '2021-02-13 04:05:06.789 MST'), ('2022-03-14 10:11:12 CST', '2023-04-15 11:12:13 EST');" ,
3153+ },
3154+ Assertions : []WireScriptTestAssertion {
3155+ {
3156+ Send : []pgproto3.FrontendMessage {
3157+ & pgproto3.Parse {
3158+ Name : "stmt_name" ,
3159+ Query : "SELECT * FROM test ORDER BY v1 NULLS FIRST;" ,
3160+ },
3161+ & pgproto3.Describe {
3162+ ObjectType : 'S' ,
3163+ Name : "stmt_name" ,
3164+ },
3165+ & pgproto3.Sync {},
3166+ },
3167+ Receive : []pgproto3.BackendMessage {
3168+ & pgproto3.ParseComplete {},
3169+ & pgproto3.ParameterDescription {ParameterOIDs : []uint32 {}},
3170+ & pgproto3.RowDescription {
3171+ Fields : []pgproto3.FieldDescription {
3172+ {
3173+ Name : []byte ("v1" ),
3174+ TableOID : 0 ,
3175+ TableAttributeNumber : 1 ,
3176+ DataTypeOID : 1184 ,
3177+ DataTypeSize : 8 ,
3178+ TypeModifier : - 1 ,
3179+ Format : 0 ,
3180+ },
3181+ {
3182+ Name : []byte ("v2" ),
3183+ TableOID : 0 ,
3184+ TableAttributeNumber : 2 ,
3185+ DataTypeOID : 1184 ,
3186+ DataTypeSize : 8 ,
3187+ TypeModifier : - 1 ,
3188+ Format : 0 ,
3189+ },
3190+ },
3191+ },
3192+ & pgproto3.ReadyForQuery {TxStatus : 'I' },
3193+ },
3194+ },
3195+ {
3196+ Send : []pgproto3.FrontendMessage {
3197+ & pgproto3.Bind {
3198+ DestinationPortal : "" ,
3199+ PreparedStatement : "stmt_name" ,
3200+ ParameterFormatCodes : nil ,
3201+ Parameters : nil ,
3202+ ResultFormatCodes : []int16 {0 },
3203+ },
3204+ & pgproto3.Execute {},
3205+ & pgproto3.Close {
3206+ ObjectType : 'P' ,
3207+ },
3208+ & pgproto3.Sync {},
3209+ },
3210+ Receive : []pgproto3.BackendMessage {
3211+ & pgproto3.BindComplete {},
3212+ & pgproto3.DataRow {
3213+ Values : [][]byte {
3214+ []byte (`Sun Jan 12 00:00:00 2020 PST` ),
3215+ []byte (`Sat Feb 13 03:05:06.789 2021 PST` ),
3216+ },
3217+ },
3218+ & pgproto3.DataRow {
3219+ Values : [][]byte {
3220+ []byte (`Mon Mar 14 09:11:12 2022 PDT` ),
3221+ []byte (`Sat Apr 15 09:12:13 2023 PDT` ),
3222+ },
3223+ },
3224+ & pgproto3.CommandComplete {CommandTag : []byte ("SELECT 2" )},
3225+ & pgproto3.CloseComplete {},
3226+ & pgproto3.ReadyForQuery {TxStatus : 'I' },
3227+ },
3228+ },
3229+ },
3230+ },
3231+ {
3232+ Name : "TIMESTAMPTZ returning binary format" ,
3233+ SetUpScript : []string {
3234+ "CREATE TABLE test (v1 TIMESTAMPTZ, v2 TIMESTAMPTZ);" ,
3235+ "INSERT INTO test VALUES ('2020-01-12 00:00:00 PST', '2021-02-13 04:05:06.789 MST'), ('2022-03-14 10:11:12 CST', '2023-04-15 11:12:13 EST');" ,
3236+ },
3237+ Assertions : []WireScriptTestAssertion {
3238+ {
3239+ Send : []pgproto3.FrontendMessage {
3240+ & pgproto3.Parse {
3241+ Name : "stmt_name" ,
3242+ Query : "SELECT * FROM test ORDER BY v1 NULLS FIRST;" ,
3243+ },
3244+ & pgproto3.Describe {
3245+ ObjectType : 'S' ,
3246+ Name : "stmt_name" ,
3247+ },
3248+ & pgproto3.Sync {},
3249+ },
3250+ Receive : []pgproto3.BackendMessage {
3251+ & pgproto3.ParseComplete {},
3252+ & pgproto3.ParameterDescription {ParameterOIDs : []uint32 {}},
3253+ & pgproto3.RowDescription {
3254+ Fields : []pgproto3.FieldDescription {
3255+ {
3256+ Name : []byte ("v1" ),
3257+ TableOID : 0 ,
3258+ TableAttributeNumber : 1 ,
3259+ DataTypeOID : 1184 ,
3260+ DataTypeSize : 8 ,
3261+ TypeModifier : - 1 ,
3262+ Format : 0 ,
3263+ },
3264+ {
3265+ Name : []byte ("v2" ),
3266+ TableOID : 0 ,
3267+ TableAttributeNumber : 2 ,
3268+ DataTypeOID : 1184 ,
3269+ DataTypeSize : 8 ,
3270+ TypeModifier : - 1 ,
3271+ Format : 0 ,
3272+ },
3273+ },
3274+ },
3275+ & pgproto3.ReadyForQuery {TxStatus : 'I' },
3276+ },
3277+ },
3278+ {
3279+ Send : []pgproto3.FrontendMessage {
3280+ & pgproto3.Bind {
3281+ DestinationPortal : "" ,
3282+ PreparedStatement : "stmt_name" ,
3283+ ParameterFormatCodes : nil ,
3284+ Parameters : nil ,
3285+ ResultFormatCodes : []int16 {1 },
3286+ },
3287+ & pgproto3.Execute {},
3288+ & pgproto3.Close {
3289+ ObjectType : 'P' ,
3290+ },
3291+ & pgproto3.Sync {},
3292+ },
3293+ Receive : []pgproto3.BackendMessage {
3294+ & pgproto3.BindComplete {},
3295+ & pgproto3.DataRow {
3296+ Values : [][]byte {
3297+ {0 , 2 , 62 , 235 , 131 , 160 , 160 , 0 },
3298+ {0 , 2 , 94 , 52 , 126 , 124 , 6 , 136 },
3299+ },
3300+ },
3301+ & pgproto3.DataRow {
3302+ Values : [][]byte {
3303+ {0 , 2 , 125 , 46 , 178 , 156 , 168 , 0 },
3304+ {0 , 2 , 156 , 96 , 253 , 63 , 81 , 64 },
3305+ },
3306+ },
3307+ & pgproto3.CommandComplete {CommandTag : []byte ("SELECT 2" )},
3308+ & pgproto3.CloseComplete {},
3309+ & pgproto3.ReadyForQuery {TxStatus : 'I' },
3310+ },
3311+ },
3312+ },
3313+ },
29813314 {
29823315 Name : "VARCHAR returning text format" ,
29833316 SetUpScript : []string {
0 commit comments