title: POSTGRES union on timestamp with time zone
body: <p>I'm trying to do a union where one of the columns is a timestamp with timezone.</p>
  
  <pre><code> UNION(SELECT au.accountId AS accountid, 
                                  u.id AS userId,
                                  CAST (NULL AS INTEGER) AS searchprofileid,
                                  u.name, 
                                  u.email AS email, 
                                  3 as searchitemtype,                                  
                                  ac.name AS accountname,
                                  null AS searchprofiletype,
                                  false AS isdeleted,
                                  false AS hashostednewsroom,
                                  u.lockoutenabled AS lockoutenabled,
                                  u.lockoutend AS lockoutend
                              FROM users u                              
                              LEFT JOIN accountusers au
                              ON u.id = au.userid
                              LEFT JOIN accounts ac
                              ON au.accountid = ac.id
                              WHERE u.name ILIKE '%%'
                              OR u.email ILIKE '%%'
                              LIMIT 5)ORDER BY 
  </code></pre>
  
  <p>this is part of a larger union but i get this error:</p>
  
  <p>UNION types text and timestamp with time zone cannot be matched</p>
  
  <p>So i cast it to text like this u.lockoutend::text AS lockoutend
  and that did work but then my backend (C#) failed when it tried to parse a string to a DateTimeOffset? . Why does it want lockoutend to be a text? And how can i do this?</p>
  
  <p>EDIT </p>
  
  <pre><code>CREATE TABLE public.users
  (
    id integer NOT NULL DEFAULT nextval('users_id_seq'::regclass),
    accessfailedcount integer NOT NULL,
    concurrencystamp character varying(255) COLLATE pg_catalog."default",
    email character varying(128) COLLATE pg_catalog."default",
    emailconfirmed boolean NOT NULL,
    lockoutenabled boolean NOT NULL,
    lockoutend timestamp with time zone,
    name character varying(128) COLLATE pg_catalog."default",
    normalizedemail character varying(128) COLLATE pg_catalog."default",
    normalizedusername character varying(128) COLLATE pg_catalog."default",
    passwordhash character varying(512) COLLATE pg_catalog."default",
    phonenumber character varying(50) COLLATE pg_catalog."default",
    phonenumberconfirmed boolean NOT NULL,
    securitystamp character varying(255) COLLATE pg_catalog."default",
    twofactorenabled boolean NOT NULL,
    username character varying(50) COLLATE pg_catalog."default",
    locale integer NOT NULL DEFAULT 1,
    CONSTRAINT users_pkey PRIMARY KEY (id)
    )
  </code></pre>
  
  <p>C#</p>
  
  <pre><code>   using (var dbConnection = _dapperConnection.Open())
          {
              _logger.LogDebug("Executing AdminSearchRepository.AdminSearch {sql}", sql);
              return await dbConnection.QueryAsync&lt;DapperAdminSearchDto&gt;(sql);
          }
  </code></pre>
  
  <p>Part of DapperAdminSearchDto:</p>
  
  <pre><code>   public bool LockoutEnabled { get; set; }
      public DateTimeOffset? LockoutEnd { get; set; }
  </code></pre>