To reproduce, compare the output of \dC on two built-in casts(json to jsonb) 
and (xml to text) where only the the first is really "with inout".

I've been using the folllowing query which (I believe) correctly shows
the (json to jsonb) cast as "with inout"

SELECT
   CONCAT('CREATE CAST (',
      C.castSource::regType, ' AS ',
      C.castTarget::regType,') ',
      CASE c.castMethod
         WHEN 'b' THEN 'WITHOUT FUNCTION'
         WHEN 'f' THEN 'WITH FUNCTION ' || C.castFunc::regProc || '('
|| pg_get_function_identity_arguments(C.castFunc) || ')'
         WHEN 'i' THEN 'WITH INOUT'
      END,
      CASE c.castContext
         WHEN 'a' THEN ' AS ASSIGNMENT '
         WHEN 'e' THEN ''
         WHEN 'i' THEN ' AS IMPLICIT'
      END)
FROM
   pg_cast C

   INNER JOIN pg_type TS
   ON C.castSource = TS.oid

   INNER JOIN pg_type TT
   ON C.castTarget = TT.oid
WHERE
   (C.castSource::regType::text, C.castTarget::regType::text) IN
(('json','jsonb'), ('xml','text'));


I've also noticed that pgAdmin III 1.22.2 has the same bug,
while pgAdmin 4 3.2 displays "with inout" casts properly.

Thanks,
Jean-Pierre Pelletier

Reply via email to