Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYwdG-0004FQ-NC for pgsql-bugs@arkaria.postgresql.org; Wed, 01 Feb 2017 15:15:38 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cYwdG-0004t2-AN for pgsql-bugs@arkaria.postgresql.org; Wed, 01 Feb 2017 15:15:38 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cYwb4-000428-Q1 for pgsql-bugs@postgreSQL.org; Wed, 01 Feb 2017 15:13:22 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cYwb2-0004cT-HI for pgsql-bugs@postgreSQL.org; Wed, 01 Feb 2017 15:13:21 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v11FDICC007448; Wed, 1 Feb 2017 10:13:18 -0500 From: Tom Lane To: Krzysztof Heim cc: pgsql-bugs@postgreSQL.org Subject: Re: BUG #14521: pg_attribute.attndims = 0 for array column In-reply-to: References: <20170201102303.1406.38167@wrigleys.postgresql.org> <3792.1485959113@sss.pgh.pa.us> Comments: In-reply-to Krzysztof Heim message dated "Wed, 01 Feb 2017 15:36:43 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7446.1485961998.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 01 Feb 2017 10:13:18 -0500 Message-ID: <7447.1485961998@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Krzysztof Heim writes: > If I may ask, what is then the best way of checking if column is array. The standard way for C code is to use this macro from lsyscache.h: #define type_is_array(typid) (get_element_type(typid) !=3D InvalidOid) or depending on what you're doing, you might want these semantics: /* type_is_array_domain accepts both plain arrays and domains over arrays */ #define type_is_array_domain(typid) (get_base_element_type(typid) !=3D Inv= alidOid) or then again, you might just want to check if the type has nonzero typelem --- that would be the appropriate thing if you want to see whether the type is subscriptable. regards, tom lane --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs