Re: Array constructor requires one argument - Mailing list pgsql-general

From Tom Lane
Subject Re: Array constructor requires one argument
Date
Msg-id 7580.1168356104@sss.pgh.pa.us
Whole thread Raw
In response to Re: Array constructor requires one argument  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: Array constructor requires one argument  (Joe Conway <mail@joeconway.com>)
List pgsql-general
Martijn van Oosterhout <kleptog@svana.org> writes:
> On Tue, Jan 09, 2007 at 10:02:09AM -0500, Tom Lane wrote:
>> Define the data type of
>> SELECT ARRAY[];

> The same type as:
> SELECT NULL;

Hardly, because whatever type NULL has, it's not an array type.

> In fact, you could just make it an unknown
> literal with just two curly vrace and you'd be all set.

Nope.  '{}' without any other decoration isn't an array at all.
You're confusing external representation with what the system
(thinks it) knows about the type of an expression.

As an example, if we did what I think you're proposing, this
would succeed:

    SELECT ARRAY[]::text;

whereas it certainly ought not, because there is no cast from
any array type to a scalar text value.

            regards, tom lane

pgsql-general by date:

Previous
From: "Joris Dobbelsteen"
Date:
Subject: Re: Autovacuum Improvements
Next
From: Tom Lane
Date:
Subject: Re: Questions about horizontal partitioning