Array detection in pg_dump - Mailing list pgsql-hackers

From Bruce Momjian
Subject Array detection in pg_dump
Date
Msg-id 200908062308.n76N8Rt27193@momjian.us
Whole thread Raw
Responses Re: Array detection in pg_dump
Re: Array detection in pg_dump
List pgsql-hackers
Is there a reason we don't use pg_type.typcategory to detect arrays in
Postgres 8.4?  Right now I see this in pg_dump.c:
   if (g_fout->remoteVersion >= 80300)   {appendPQExpBuffer(query, "SELECT tableoid, oid, typname, "
"typnamespace,"          "(%s typowner) AS rolname, "          "typinput::oid AS typinput, "          "typoutput::oid
AStypoutput, typelem, typrelid, "          "CASE WHEN typrelid = 0 THEN ' '::\"char\" "          "ELSE (SELECT relkind
FROMpg_class WHERE oid = typrelid) END AS typrelkind, "          "typtype, typisdefined, "          "typname[0] = '_'
ANDtypelem != 0 AND "
 
-->  "(SELECT typarray FROM pg_type te WHERE oid = pg_type.typelem) = oid AS isarray "          "FROM pg_type",
username_subquery);   }
 

It seems the appropriate 8.4+ test would be:
t.typtype = 'b' AND t.typcategory = 'A'

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Table and Index compression
Next
From: Tom Lane
Date:
Subject: Re: mixed, named notation support