Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hJlX2-00066g-Ng for pgsql-general@arkaria.postgresql.org; Thu, 25 Apr 2019 21:03:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hJlX1-0006hM-EN for pgsql-general@arkaria.postgresql.org; Thu, 25 Apr 2019 21:03:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hJlX1-0006cH-0S for pgsql-general@lists.postgresql.org; Thu, 25 Apr 2019 21:03:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hJlWy-0005C0-PN for pgsql-general@postgresql.org; Thu, 25 Apr 2019 21:03:45 +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 x3PL3h89031660; Thu, 25 Apr 2019 17:03:43 -0400 From: Tom Lane To: Piotr Findeisen cc: pgsql-general@postgresql.org Subject: Re: Is _ a supported way to create a column of array type? In-reply-to: References: Comments: In-reply-to Piotr Findeisen message dated "Thu, 25 Apr 2019 21:52:51 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31658.1556226223.1@sss.pgh.pa.us> Date: Thu, 25 Apr 2019 17:03:43 -0400 Message-ID: <31659.1556226223@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Piotr Findeisen writes: > Internally, array types get a name in the form of `_`. Typically, yes. > *Can a user use `_` to define a column of array type?* Sure ... didn't you try it? > *Is it supported?* Not really, because it's not guaranteed that the name looks like that. There are various corner cases where something else would be generated, either to avoid a collision, or because truncation is needed. However, if you've taken the trouble to check what name actually got assigned to the array type, it's perfectly valid to use that name. > The reason I am asking is that e.g. int4[] and _int4 behave differently. > Although they look the same, the have different pg_attribute.attndims. Yeah. Nothing really cares about attndims though ... it's vestigial. Perhaps we should remove it someday. regards, tom lane